t('The base table for submenutree'), 'fields' => array( 'nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'disp-width' => '10'), 'submenutree_enable' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'disp-width' => '10'), 'submenutree_title' => array('type' => 'varchar', 'length' => '255', 'not null' => TRUE, 'default' => ''), 'submenutree_display' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'disp-width' => '10'), 'submenutree_weight' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'disp-width' => '10'), 'siblingmenutree_enable' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'disp-width' => '10'), 'siblingmenutree_title' => array('type' => 'varchar', 'length' => '255', 'not null' => TRUE, 'default' => ''), 'siblingmenutree_display' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'disp-width' => '10'), 'siblingmenutree_weight' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'disp-width' => '10')), 'primary key' => array('nid'), ); return $schema; } /** * Implementation of hook_install(). */ function submenutree_install() { drupal_install_schema('submenutree'); } /** * Implementation of hook_uninstall(). */ function submenutree_uninstall() { drupal_uninstall_schema('submenutree'); } /* This is an update from submenutree 5.x-0.x. Leave it here for now */ function submenutree_update_5001() { $ret = array(); switch ($GLOBALS['db_type']) { case 'mysql': case 'mysqli': $ret[] = update_sql("ALTER TABLE {node_submenutree} ADD submenutree_enable int(10) unsigned NOT NULL default '0' AFTER nid"); $ret[] = update_sql("ALTER TABLE {node_submenutree} ADD submenutree_title varchar(255) NOT NULL default '' AFTER submenutree_enable"); $ret[] = update_sql("ALTER TABLE {node_submenutree} CHANGE display submenutree_display int(10) unsigned NOT NULL default '0'"); $ret[] = update_sql("ALTER TABLE {node_submenutree} CHANGE weight submenutree_weight int(10) unsigned NOT NULL default '0'"); $ret[] = update_sql("ALTER TABLE {node_submenutree} ADD siblingmenutree_enable int(10) unsigned NOT NULL default '0'"); $ret[] = update_sql("ALTER TABLE {node_submenutree} ADD siblingmenutree_title varchar(255) NOT NULL default ''"); $ret[] = update_sql("ALTER TABLE {node_submenutree} ADD siblingmenutree_display int(10) unsigned NOT NULL default '0'"); $ret[] = update_sql("ALTER TABLE {node_submenutree} ADD siblingmenutree_weight int(10) unsigned NOT NULL default '0'"); $ret[] = update_sql("UPDATE {node_submenutree} SET submenutree_enable = 1"); break; } return $ret; } /** * Make columns submenutree_weight and siblingmenutree_weight signed integers. * See http://drupal.org/node/455690 */ function submenutree_update_6001() { $fields = array( 'submenutree_weight' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'disp-width' => '10'), 'siblingmenutree_weight' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'disp-width' => '10'), ); $ret = array(); foreach ($fields as $field => $spec) { db_change_field($ret, 'node_submenutree', $field, $field, $spec); } return $ret; }