function regcode_schema in Registration codes 6.2
Same name and namespace in other branches
- 8 regcode.install \regcode_schema()
- 6 regcode.install \regcode_schema()
- 7.2 regcode.install \regcode_schema()
- 7 regcode.install \regcode_schema()
Implementation of hook_schema().
1 call to regcode_schema()
- regcode_update_6200 in ./
regcode.install - Implementation of hook_update_N()
File
- ./
regcode.install, line 106 - Install, uninstall and scheme functions for the regcode module.
Code
function regcode_schema() {
// Definition for the regcode table
$schema['regcode'] = array(
'description' => t('Hold registration codes'),
'fields' => array(
'rid' => array(
'description' => t('RID'),
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'uid' => array(
'description' => t('User ID'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => FALSE,
),
'created' => array(
'description' => t('Code creation time'),
'type' => 'int',
'not null' => FALSE,
),
'lastused' => array(
'description' => t('Code last used time'),
'type' => 'int',
'not null' => FALSE,
),
'begins' => array(
'description' => t('Code activation date'),
'type' => 'int',
'not null' => FALSE,
),
'expires' => array(
'description' => t('Code expiry date'),
'type' => 'int',
'not null' => FALSE,
),
'code' => array(
'description' => t('The registration code'),
'type' => 'varchar',
'length' => '255',
'not null' => TRUE,
'default' => '',
),
'is_active' => array(
'description' => t('Whether the code is active'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 1,
),
'maxuses' => array(
'description' => t('Maximum times a code can be used'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 1,
),
'uses' => array(
'description' => t('Number of times the code has been used'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array(
'rid',
),
'unique keys' => array(
'code' => array(
'code',
),
),
);
// Definition for the regcode_term table
$schema['regcode_term'] = array(
'description' => t('Map registration codes and taxonomy'),
'fields' => array(
'id' => array(
'description' => t('ID'),
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'rid' => array(
'description' => t('Regcode ID'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => FALSE,
),
'tid' => array(
'description' => t('Term ID'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => FALSE,
),
),
'primary key' => array(
'id',
),
'indexes' => array(
'regcode_term' => array(
'rid',
'tid',
),
),
);
return $schema;
}