You are here

function power_menu_schema in Power Menu 6

Same name and namespace in other branches
  1. 7.2 power_menu.install \power_menu_schema()
  2. 7 power_menu.install \power_menu_schema()

Implementation of hook_schema().

1 call to power_menu_schema()
power_menu_update_6003 in ./power_menu.install
update. Add the properties table

File

./power_menu.install, line 27
just containing the stuff for install and uninstall

Code

function power_menu_schema() {
  $schema['power_menu'] = array(
    'description' => t('Save the relation between menu and taxonomy term'),
    'fields' => array(
      'mid' => array(
        'description' => t('Just a key'),
        'type' => 'varchar',
        'length' => 40,
        'not null' => TRUE,
      ),
      'mlid' => array(
        'description' => t('Menu item id'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'tid' => array(
        'description' => t('Termid'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'nodetype' => array(
        'description' => t('Nodetype'),
        'type' => 'varchar',
        'length' => 50,
        'not null' => FALSE,
      ),
      'path' => array(
        'description' => t('Path, this is redundant, but better performance'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
      ),
      'menu_name' => array(
        'description' => 'The menu which was selected',
        'type' => 'varchar',
        'length' => 100,
        'not null' => TRUE,
        'default' => '',
      ),
    ),
    'primary key' => array(
      'mid',
    ),
    'indexes' => array(
      'tid' => array(
        'tid',
      ),
      'path' => array(
        'path',
      ),
      'nodetype' => array(
        'nodetype',
      ),
      'menu_name' => array(
        'menu_name',
      ),
    ),
  );
  $schema['power_menu_properties'] = array(
    'fields' => array(
      'mlid' => array(
        'description' => t('Menu item id'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'property_name' => array(
        'description' => 'Name of the property',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'value' => array(
        'description' => 'The value of the property',
        'type' => 'text',
        'not null' => TRUE,
      ),
    ),
    'primary key' => array(
      'mlid',
      'property_name',
    ),
  );
  return $schema;
}