You are here

function workbench_workflows_schema in Workbench Moderation 7.2

Implements hook_schema().

1 call to workbench_workflows_schema()
workbench_workflows_db_update in modules/workbench_workflows/workbench_workflows.install
Helper to do db updates.

File

modules/workbench_workflows/workbench_workflows.install, line 11
Database functions for workbench_workflows.

Code

function workbench_workflows_schema() {
  $schema = array();

  // Define the states schema.
  $schema["workbench_workflows_states"] = workbench_workflows_starter_schema('state');

  // Add fields to the states schema.
  $additional_state_fields = array(
    'entity_state_change' => array(
      'type' => 'int',
      'length' => 'small',
      'description' => 'Defines the state change on the entity level',
      'object default' => -1,
    ),
  );
  $schema['workbench_workflows_states']['fields'] = array_merge($schema['workbench_workflows_states']['fields'], $additional_state_fields);

  // Define the events schema.
  $schema["workbench_workflows_events"] = workbench_workflows_starter_schema('event');

  // Add fields to the events schema.
  $additional_event_fields = array(
    'target_state' => array(
      'type' => 'varchar',
      'length' => '255',
      'description' => 'target state',
    ),
    'origin_states' => array(
      'type' => 'text',
      'size' => 'big',
      'description' => 'Origin states',
      'serialize' => TRUE,
      'object default' => array(),
    ),
    'schedulable' => array(
      'type' => 'int',
      'size' => 'tiny',
      'description' => 'This state can be scheduled with state flow scheduler',
      'object default' => FALSE,
    ),
  );
  $schema["workbench_workflows_events"]['fields'] = array_merge($schema["workbench_workflows_events"]['fields'], $additional_event_fields);

  // Define the workflows schema
  $schema["workbench_workflows_workflows"] = workbench_workflows_starter_schema('workflow');
  $additional_workflow_fields = array(
    'category' => array(
      'type' => 'varchar',
      'length' => '64',
      'description' => 'The category this workbench workflow appears in.',
    ),
    'states' => array(
      'type' => 'text',
      'size' => 'big',
      'serialize' => TRUE,
      'object default' => array(),
      'description' => 'An array of states allowed in the workflow',
    ),
    'default_state' => array(
      'type' => 'text',
      'size' => 'big',
      'serialize' => FALSE,
      'object default' => '',
      'description' => 'The starter state of the workflow.',
    ),
    'events' => array(
      'type' => 'text',
      'size' => 'big',
      'serialize' => TRUE,
      'object default' => array(),
      'description' => 'An array of events allowed in the workflow',
    ),
  );
  $schema["workbench_workflows_workflows"]['fields'] = array_merge($schema["workbench_workflows_workflows"]['fields'], $additional_workflow_fields);
  return $schema;
}