You are here

function workbench_access_update_7001 in Workbench Access 7

Add the role-based storage table.

NOTE: This update only affects sites on the pre-drupal.org release.

File

./workbench_access.install, line 251
Install file for Workbench Access.

Code

function workbench_access_update_7001() {
  if (db_table_exists('workbench_access_role')) {
    return t('Update is not required.');
  }
  $schema = array(
    'description' => 'Maps role access to sections',
    'fields' => array(
      'rid' => array(
        'description' => 'The role identifier. Foreign key to {role}.',
        'type' => 'int',
        'not null' => TRUE,
      ),
      'access_id' => array(
        'description' => 'The section identifier. Foreign key to {workbench_access}.',
        'type' => 'varchar',
        'length' => '80',
        'not null' => TRUE,
        'default' => '',
      ),
      'access_scheme' => array(
        'description' => 'The module responsbile for this access system.',
        'type' => 'varchar',
        'length' => '40',
        'not null' => TRUE,
        'default' => '',
      ),
    ),
    'primary key' => array(
      'rid',
      'access_id',
      'access_scheme',
    ),
    'foreign keys' => array(
      'section_id' => array(
        'workbench_access' => array(
          'access_id',
          'access_scheme',
        ),
      ),
      'rid' => array(
        'role' => 'rid',
      ),
    ),
  );
  db_create_table('workbench_access_role', $schema);
  return t('Added the workbench_access_role table');
}