| 1 |
<?php
|
| 2 |
// $Id: submenutree.install,v 1.3 2008/05/26 05:18:12 bengtan Exp $
|
| 3 |
// Modeline for drupal
|
| 4 |
// vim: set expandtab tabstop=2 shiftwidth=2 autoindent smartindent filetype=php:
|
| 5 |
|
| 6 |
/**
|
| 7 |
* Implementation of hook_schema().
|
| 8 |
*/
|
| 9 |
function submenutree_schema() {
|
| 10 |
$schema['node_submenutree'] = array(
|
| 11 |
'description' => t('The base table for submenutree'),
|
| 12 |
'fields' => array(
|
| 13 |
'nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'disp-width' => '10'),
|
| 14 |
'submenutree_enable' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'disp-width' => '10'),
|
| 15 |
'submenutree_title' => array('type' => 'varchar', 'length' => '255', 'not null' => TRUE, 'default' => ''),
|
| 16 |
'submenutree_display' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'disp-width' => '10'),
|
| 17 |
'submenutree_weight' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'disp-width' => '10'),
|
| 18 |
'siblingmenutree_enable' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'disp-width' => '10'),
|
| 19 |
'siblingmenutree_title' => array('type' => 'varchar', 'length' => '255', 'not null' => TRUE, 'default' => ''),
|
| 20 |
'siblingmenutree_display' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'disp-width' => '10'),
|
| 21 |
'siblingmenutree_weight' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'disp-width' => '10')),
|
| 22 |
'primary key' => array('nid'),
|
| 23 |
);
|
| 24 |
return $schema;
|
| 25 |
}
|
| 26 |
|
| 27 |
/**
|
| 28 |
* Implementation of hook_install().
|
| 29 |
*/
|
| 30 |
function submenutree_install() {
|
| 31 |
drupal_install_schema('submenutree');
|
| 32 |
}
|
| 33 |
|
| 34 |
/**
|
| 35 |
* Implementation of hook_uninstall().
|
| 36 |
*/
|
| 37 |
function submenutree_uninstall() {
|
| 38 |
drupal_uninstall_schema('submenutree');
|
| 39 |
}
|
| 40 |
|
| 41 |
/* This is an update from submenutree 5.x-0.x. Leave it here for now */
|
| 42 |
function submenutree_update_5001() {
|
| 43 |
$ret = array();
|
| 44 |
switch ($GLOBALS['db_type']) {
|
| 45 |
case 'mysql':
|
| 46 |
case 'mysqli':
|
| 47 |
$ret[] = update_sql("ALTER TABLE {node_submenutree} ADD submenutree_enable int(10) unsigned NOT NULL default '0' AFTER nid");
|
| 48 |
$ret[] = update_sql("ALTER TABLE {node_submenutree} ADD submenutree_title varchar(255) NOT NULL default '' AFTER submenutree_enable");
|
| 49 |
$ret[] = update_sql("ALTER TABLE {node_submenutree} CHANGE display submenutree_display int(10) unsigned NOT NULL default '0'");
|
| 50 |
$ret[] = update_sql("ALTER TABLE {node_submenutree} CHANGE weight submenutree_weight int(10) unsigned NOT NULL default '0'");
|
| 51 |
$ret[] = update_sql("ALTER TABLE {node_submenutree} ADD siblingmenutree_enable int(10) unsigned NOT NULL default '0'");
|
| 52 |
$ret[] = update_sql("ALTER TABLE {node_submenutree} ADD siblingmenutree_title varchar(255) NOT NULL default ''");
|
| 53 |
$ret[] = update_sql("ALTER TABLE {node_submenutree} ADD siblingmenutree_display int(10) unsigned NOT NULL default '0'");
|
| 54 |
$ret[] = update_sql("ALTER TABLE {node_submenutree} ADD siblingmenutree_weight int(10) unsigned NOT NULL default '0'");
|
| 55 |
|
| 56 |
$ret[] = update_sql("UPDATE {node_submenutree} SET submenutree_enable = 1");
|
| 57 |
break;
|
| 58 |
}
|
| 59 |
return $ret;
|
| 60 |
}
|
| 61 |
|
| 62 |
|