regcode.install in Registration codes 6
Same filename and directory in other branches
Install, uninstall and scheme functions for the regcode module.
File
regcode.installView source
<?php
/**
* @file
* Install, uninstall and scheme functions for the regcode module.
*/
/**
* Implementation of hook_uninstall().
*/
function regcode_uninstall() {
drupal_uninstall_schema('regcode');
}
/**
* Implementation of hook_install().
*/
function regcode_install() {
drupal_install_schema('regcode');
}
/**
* Implementation of hook_schema().
*/
function regcode_schema() {
$schema['regcode'] = array(
'description' => t('Hold registration codes'),
'fields' => array(
'rid' => array(
'description' => t('RID'),
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
'disp-width' => '11',
'#exposed' => FALSE,
'#heading' => t('ID'),
),
'uid' => array(
'description' => t('User ID'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => FALSE,
'disp-width' => '11',
'#exposed' => FALSE,
'#heading' => t('UID'),
),
'created' => array(
'description' => t('Time code was created'),
'type' => 'datetime',
'not null' => FALSE,
'#exposed' => FALSE,
'#heading' => t('Created'),
),
'lastused' => array(
'description' => t('Last time this code was used'),
'type' => 'datetime',
'not null' => FALSE,
'#exposed' => FALSE,
'#heading' => t('Used'),
),
'begins' => array(
'description' => t('When code should be active from'),
'type' => 'datetime',
'not null' => FALSE,
'#exposed' => TRUE,
'#heading' => t('Begins'),
),
'expires' => array(
'description' => t('When code should expire'),
'type' => 'datetime',
'not null' => FALSE,
'#exposed' => TRUE,
'#heading' => t('Expires'),
),
'category' => array(
'description' => t('A grouping category to help management'),
'type' => 'varchar',
'length' => '255',
'not null' => FALSE,
'#exposed' => TRUE,
'#heading' => t('Category'),
),
'code' => array(
'description' => t('The registration code'),
'type' => 'varchar',
'length' => '255',
'not null' => TRUE,
'default' => '',
'#exposed' => TRUE,
'#heading' => t('Code'),
),
'is_active' => array(
'description' => t('Whether the code is active'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 1,
'disp-width' => '1',
'#exposed' => TRUE,
'#heading' => t('Enabled'),
),
'maxuses' => array(
'description' => t('Maximum times the code can be used'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 1,
'disp-width' => '11',
'#exposed' => TRUE,
'#heading' => t('Max'),
),
'uses' => array(
'description' => t('Number of times the code has been used'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'disp-width' => '11',
'#exposed' => TRUE,
'#heading' => t('Uses'),
),
),
'primary key' => array(
'rid',
),
'unique keys' => array(
'code' => array(
'code',
),
),
'indexes' => array(
'begins' => array(
'begins',
),
'category' => array(
'category',
),
'expires' => array(
'expires',
),
),
);
return $schema;
}
Functions
Name | Description |
---|---|
regcode_install | Implementation of hook_install(). |
regcode_schema | Implementation of hook_schema(). |
regcode_uninstall | Implementation of hook_uninstall(). |