You are here

function workbench_moderation_schema in Workbench Moderation 7

Same name and namespace in other branches
  1. 7.3 workbench_moderation.install \workbench_moderation_schema()

Implements hook_schema().

File

./workbench_moderation.install, line 50
Install file for the Workbench Moderation module.

Code

function workbench_moderation_schema() {
  $schema['workbench_moderation_states'] = array(
    'description' => 'Defines all possible states',
    'fields' => array(
      'name' => array(
        'description' => 'The machine name of the moderation state.',
        'type' => 'varchar',
        'length' => '255',
        'not null' => TRUE,
      ),
      'label' => array(
        'description' => 'A label for the moderation state.',
        'type' => 'varchar',
        'length' => '255',
        'not null' => FALSE,
      ),
      'description' => array(
        'description' => 'A description of the moderation state.',
        'type' => 'varchar',
        'length' => '255',
        'not null' => FALSE,
      ),
      'weight' => array(
        'description' => 'Sort weight for the moderation state.',
        'type' => 'int',
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'name',
    ),
  );
  $schema['workbench_moderation_transitions'] = array(
    'description' => 'Defines the valid transitions for states',
    'fields' => array(
      'id' => array(
        'type' => 'serial',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'description' => 'Primary Key: Unique workbench_moderation transition identifier.',
      ),
      'name' => array(
        'description' => 'The machine-readable name of this workbench_moderation transition.',
        'type' => 'varchar',
        'length' => 255,
        'initial' => 'from_name',
      ),
      'from_name' => array(
        'description' => 'The starting moderation state.',
        'type' => 'varchar',
        'length' => '255',
        'not null' => FALSE,
      ),
      'to_name' => array(
        'description' => 'The ending moderation state.',
        'type' => 'varchar',
        'length' => '255',
        'not null' => FALSE,
      ),
    ),
    'primary key' => array(
      'id',
    ),
  );
  $schema['workbench_moderation_node_history'] = array(
    'fields' => array(
      'hid' => array(
        'description' => 'Node history entry key.',
        'type' => 'serial',
        'not null' => TRUE,
      ),
      'vid' => array(
        'description' => 'Node revision id. Foreign key to {node_revision}',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'nid' => array(
        'description' => 'Node id. Foreign key to {node}',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'from_state' => array(
        'description' => 'The old moderation state of the node',
        'type' => 'varchar',
        'length' => '255',
        'not null' => FALSE,
      ),
      'state' => array(
        'description' => 'The current moderation state of the node.',
        'type' => 'varchar',
        'length' => '255',
        'not null' => FALSE,
      ),
      'uid' => array(
        'description' => 'The user id of the moderator who made the change. Foreign key to {users}.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'stamp' => array(
        'description' => 'The timestamp of the change.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'published' => array(
        'description' => 'Indicated the live revision of a node.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'is_current' => array(
        'description' => 'Indicated the current revision of a node.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'hid',
    ),
    'indexes' => array(
      'nid' => array(
        'nid',
      ),
      'vid' => array(
        'vid',
      ),
    ),
    'foreign_keys' => array(
      'nid' => array(
        'node' => 'nid',
      ),
      'vid' => array(
        'node_revision' => 'vid',
      ),
      'uid' => array(
        'users' => 'uid',
      ),
    ),
  );
  return $schema;
}