workbench_scheduler.install in Workbench Scheduler 7
Same filename and directory in other branches
Contains install and update functions for workbench_scheduler.
File
workbench_scheduler.installView source
<?php
/**
* @file
* Contains install and update functions for workbench_scheduler.
*/
/**
* Implements hook_schema().
*/
function workbench_scheduler_schema() {
$schema = array();
// Schedules table.
$schema['workbench_scheduler_schedules'] = array(
'description' => 'Saves data for workbench schedules that can be run on the system',
'fields' => array(
'sid' => array(
'description' => 'The unique id for a schedule',
'type' => 'serial',
'not null' => TRUE,
),
'name' => array(
'description' => 'A unique machine name to identify the schedule',
'type' => 'varchar',
'length' => '255',
'not null' => TRUE,
),
'label' => array(
'description' => 'A label for the schedule',
'type' => 'varchar',
'length' => '255',
'not null' => TRUE,
),
'start_state' => array(
'description' => 'The state to set at the start date',
'type' => 'varchar',
'length' => '255',
'not null' => TRUE,
),
'end_state' => array(
'description' => 'The state to set at the end date',
'type' => 'varchar',
'length' => '255',
'not null' => TRUE,
),
),
'primary key' => array(
'sid',
),
'unique keys' => array(
'name' => array(
'name',
),
),
);
// Schedule content types table.
$schema['workbench_scheduler_types'] = array(
'description' => 'Saves the associations between schedules and content types',
'fields' => array(
'name' => array(
'description' => 'The machine name of a schedule',
'type' => 'varchar',
'length' => '255',
'not null' => TRUE,
),
'type' => array(
'description' => 'The machine name of a content type',
'type' => 'varchar',
'length' => '255',
'not null' => TRUE,
),
),
'unique keys' => array(
'name_type' => array(
'name',
'type',
),
),
);
// Schedule nodes table.
$schema['workbench_scheduler_nodes'] = array(
'description' => 'Saves the schedule information for nodes',
'fields' => array(
'nid' => array(
'description' => 'The node id',
'type' => 'int',
'not null' => TRUE,
'unsigned' => TRUE,
),
'vid' => array(
'description' => 'The revision id of the node',
'type' => 'int',
'not null' => TRUE,
'unsigned' => TRUE,
),
'sid' => array(
'description' => 'The id of the schedule',
'type' => 'int',
'not null' => TRUE,
'unsigned' => TRUE,
),
'start_date' => array(
'description' => 'the date when the start state should be applied',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'end_date' => array(
'description' => 'the date when the end state should be applied',
'type' => 'int',
'unsigned' => TRUE,
'default' => 0,
'not null' => FALSE,
),
'completed' => array(
'description' => 'mark if the schedule has been completed for this node',
'type' => 'int',
'unsigned' => TRUE,
'default' => 0,
'not null' => FALSE,
),
),
'unique keys' => array(
'vid' => array(
'vid',
),
),
'foreign_keys' => array(
'nid' => array(
'node' => 'nid',
),
'vid' => array(
'node_revision' => 'vid',
),
'sid' => array(
'workbench_scheduler_schedules' => 'sid',
),
),
);
return $schema;
}
Functions
Name | Description |
---|---|
workbench_scheduler_schema | Implements hook_schema(). |