| 1 |
<?php |
<?php |
| 2 |
// $Id$ |
// $Id: type_local_nids.install,v 1.1.2.1 2008/03/25 03:51:40 jbrown Exp $ |
| 3 |
|
|
| 4 |
|
|
| 5 |
function type_local_nids_install() { |
/** |
| 6 |
|
* @file |
| 7 |
|
* Install, update and uninstall functions for the type_local_nids module. |
| 8 |
|
*/ |
| 9 |
|
|
| 10 |
|
|
| 11 |
|
/** |
| 12 |
|
* Implement hook_schema(). |
| 13 |
|
*/ |
| 14 |
|
function type_local_nids_schema() { |
| 15 |
|
|
| 16 |
|
$schema['node_lnid_next'] = array( |
| 17 |
|
'description' => 'Maintains the next lnid for each node type.', |
| 18 |
|
'fields' => array( |
| 19 |
|
'type' => array( |
| 20 |
|
'description' => 'The node type.', |
| 21 |
|
'type' => 'varchar', |
| 22 |
|
'length' => 32, |
| 23 |
|
'not null' => TRUE |
| 24 |
|
), |
| 25 |
|
'next_lnid' => array( |
| 26 |
|
'description' => 'The next lnid.', |
| 27 |
|
'type' => 'int', |
| 28 |
|
'unsigned' => TRUE, |
| 29 |
|
'not null' => TRUE |
| 30 |
|
) |
| 31 |
|
), |
| 32 |
|
'primary key' => array('type') |
| 33 |
|
); |
| 34 |
|
|
| 35 |
|
$schema['node_lnid'] = array( |
| 36 |
|
'description' => 'Maintains the lnid for each node', |
| 37 |
|
'fields' => array( |
| 38 |
|
'nid' => array( |
| 39 |
|
'description' => 'The nid.', |
| 40 |
|
'type' => 'int', |
| 41 |
|
'unsigned' => TRUE, |
| 42 |
|
'not null' => TRUE |
| 43 |
|
), |
| 44 |
|
'lnid' => array( |
| 45 |
|
'description' => 'The lnid.', |
| 46 |
|
'type' => 'int', |
| 47 |
|
'unsigned' => TRUE, |
| 48 |
|
'not null' => TRUE |
| 49 |
|
) |
| 50 |
|
), |
| 51 |
|
'primary key' => array('nid') |
| 52 |
|
); |
| 53 |
|
|
| 54 |
switch ($GLOBALS['db_type']) { |
return $schema; |
|
case 'mysql': |
|
|
case 'mysqli': |
|
|
|
|
|
db_query(" |
|
|
CREATE TABLE node_lnid_next ( |
|
|
type VARCHAR(32) NOT NULL, |
|
|
next_lnid INT(10) UNSIGNED NOT NULL, |
|
|
PRIMARY KEY (type) |
|
|
) |
|
|
"); |
|
|
|
|
|
db_query(" |
|
|
CREATE TABLE node_lnid ( |
|
|
nid int(10) unsigned NOT NULL, |
|
|
lnid int(10) unsigned NOT NULL, |
|
|
PRIMARY KEY (nid) |
|
|
) |
|
|
"); |
|
|
|
|
|
break; |
|
|
|
|
|
case 'pgsql': |
|
|
break; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function type_local_nids_uninstall() { |
|
|
db_query('DROP TABLE {node_lnid_next}'); |
|
|
db_query('DROP TABLE {node_lnid}'); |
|
| 55 |
} |
} |
| 56 |
|
|