function shortcut_schema

Same name in other branches
  1. 7.x modules/shortcut/shortcut.install \shortcut_schema()
  2. 8.9.x core/modules/shortcut/shortcut.install \shortcut_schema()
  3. 10 core/modules/shortcut/shortcut.install \shortcut_schema()
  4. 11.x core/modules/shortcut/shortcut.install \shortcut_schema()

Implements hook_schema().

File

core/modules/shortcut/shortcut.install, line 11

Code

function shortcut_schema() {
    $schema['shortcut_set_users'] = [
        'description' => 'Maps users to shortcut sets.',
        'fields' => [
            'uid' => [
                'type' => 'int',
                'unsigned' => TRUE,
                'not null' => TRUE,
                'default' => 0,
                'description' => 'The {users}.uid for this set.',
            ],
            'set_name' => [
                'type' => 'varchar_ascii',
                'length' => 32,
                'not null' => TRUE,
                'default' => '',
                'description' => "The {shortcut_set}.set_name that will be displayed for this user.",
            ],
        ],
        'primary key' => [
            'uid',
        ],
        'indexes' => [
            'set_name' => [
                'set_name',
            ],
        ],
        'foreign keys' => [
            'set_user' => [
                'table' => 'users',
                'columns' => [
                    'uid' => 'uid',
                ],
            ],
            'set_name' => [
                'table' => 'shortcut_set',
                'columns' => [
                    'set_name' => 'set_name',
                ],
            ],
        ],
    ];
    return $schema;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.