You are here

function colossal_menu_schema in Colossal Menu 2.x

Same name and namespace in other branches
  1. 8 colossal_menu.install \colossal_menu_schema()

Implements hook_schema().

File

./colossal_menu.install, line 11
Install, update and uninstall functions for the Colossal Menu.

Code

function colossal_menu_schema() {
  return [
    'colossal_menu_link_tree' => [
      'description' => 'Colossal Menu Link Tree',
      'fields' => [
        'ancestor' => [
          'description' => 'The current {colossal_menu_link_tree}.id ancestor.',
          'type' => 'int',
          'unsigned' => TRUE,
          'not null' => TRUE,
        ],
        'descendant' => [
          'description' => 'The current {colossal_menu_link}.id descendant.',
          'type' => 'int',
          'unsigned' => TRUE,
          'not null' => TRUE,
        ],
        'depth' => [
          'description' => 'The depth of the descendant compared to the ancestor.',
          'type' => 'int',
          'unsigned' => TRUE,
          'not null' => TRUE,
          'default' => 0,
        ],
      ],
      'indexes' => [
        'colossal_menu_link_tree_ancestor' => [
          'ancestor',
        ],
        'colossal_menu_link_tree_descendant' => [
          'descendant',
        ],
        'colossal_menu_link_tree_depth' => [
          'depth',
        ],
      ],
      'foreign keys' => [
        'colossal_menu_link_ancestor' => [
          'table' => 'colossal_menu_link',
          'columns' => [
            'ancestor' => 'id',
          ],
        ],
        'colossal_menu_link_descendant' => [
          'table' => 'colossal_menu_link',
          'columns' => [
            'descendant' => 'id',
          ],
        ],
      ],
      'primary key' => [
        'ancestor',
        'descendant',
      ],
    ],
  ];
}