View source
<?php
function og_menu_schema() {
$schema['og_menu'] = array(
'fields' => array(
'gid' => array(
'type' => 'int',
'not null' => TRUE,
),
'menu_name' => array(
'type' => 'varchar',
'length' => 128,
'default' => '',
),
),
'primary key' => array(
'gid',
'menu_name',
),
);
return $schema;
}
function og_menu_install() {
drupal_install_schema('og_menu');
}
function og_menu_uninstall() {
drupal_uninstall_schema('og_menu');
}
function og_menu_update_6200() {
drupal_install_schema('og_menu');
$result = db_query("SELECT * FROM {og_menu_groups}");
while ($menu = db_fetch_array($result)) {
db_query("INSERT INTO {og_menu} (gid, menu_name) VALUES (%d, '%s')", $menu['gid'], $menu['mid']);
}
db_query('DROP TABLE {og_menu_groups}');
}