| 1 |
<?php |
<?php |
| 2 |
// $Id$ |
// $Id$ |
| 3 |
|
|
| 4 |
|
/** |
| 5 |
|
* Definition of hook_schema(); |
| 6 |
|
*/ |
| 7 |
|
function og_reg_keys_schema() { |
| 8 |
|
$schema = array(); |
| 9 |
|
$schema['og_reg_keys'] = array( |
| 10 |
|
'description' => t('Track group registration keys for each group based on nid.'), |
| 11 |
|
'fields' => array( |
| 12 |
|
'nid' => array( |
| 13 |
|
'description' => t("The group's {node}.nid."), |
| 14 |
|
'type' => 'int', |
| 15 |
|
'size' => 'normal', |
| 16 |
|
'not null' => TRUE, |
| 17 |
|
'default' => 0, |
| 18 |
|
), |
| 19 |
|
'code' => array( |
| 20 |
|
'description' => t('Registration code. Must be unique.'), |
| 21 |
|
'type' => 'varchar', |
| 22 |
|
'length' => 64, |
| 23 |
|
'not null' => TRUE, |
| 24 |
|
'default' => '', |
| 25 |
|
), |
| 26 |
|
), |
| 27 |
|
'primary key' => array('nid'), |
| 28 |
|
'indexes' => array( |
| 29 |
|
'code' => array('code'), |
| 30 |
|
), |
| 31 |
|
); |
| 32 |
|
|
| 33 |
|
return $schema; |
| 34 |
|
} |
| 35 |
|
|
| 36 |
|
|
| 37 |
function og_reg_keys_install() { |
function og_reg_keys_install() { |
| 38 |
// key is a db reserved word for some db's so we use code instead |
drupal_install_schema('og_reg_keys'); |
|
switch ($GLOBALS['db_type']) { |
|
|
case 'mysql': |
|
|
case 'mysqli': |
|
|
db_query("CREATE TABLE {og_reg_keys} ( |
|
|
nid INT NOT NULL DEFAULT 0, |
|
|
code varchar(64) NOT NULL DEFAULT '', |
|
|
PRIMARY KEY `nid` (`nid`), |
|
|
INDEX `code` (`code`) |
|
|
) |
|
|
/*!40100 DEFAULT CHARACTER SET utf8 */ COMMENT = 'track group registration keys for each group based on nid';"); |
|
|
break; |
|
|
} |
|
| 39 |
} |
} |
| 40 |
|
|
| 41 |
function og_reg_keys_uninstall() { |
function og_reg_keys_uninstall() { |
| 42 |
switch ($GLOBALS['db_type']) { |
drupal_uninstall_schema('og_reg_keys'); |
|
case 'mysql': |
|
|
case 'mysqli': |
|
|
db_query("DROP TABLE {og_reg_keys}"); |
|
|
break; |
|
|
} |
|
| 43 |
} |
} |