123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823 |
- <?php
- /**
- * @file
- * Install, update and uninstall functions for the workflow module.
- */
- /**
- * Implements hook_enable().
- */
- function workflow_enable() {
- $message = t('Thanks for using Workflow. To maintain workflows, enable the
- <a href="!url_ui">Workflow UI module</a>. To add a Workflow Field to your
- entity, enable the <a href="!url_field">Workflow Field module</a>.',
- array(
- '!url_ui' => url('admin/config/modules'),
- '!url_field' => url('admin/config/modules'),
- )
- );
- drupal_set_message($message);
- }
- /**
- * Implements hook_uninstall().
- */
- function workflow_uninstall() {
- variable_del('workflow_states_per_page');
- // Delete type-workflow mapping variables.
- foreach (node_type_get_types() as $type => $name) {
- variable_del('workflow_' . $type);
- }
- }
- /**
- * Implements hook_requirements().
- *
- * Let admins know that Workflow is in use.
- *
- * @todo: extend workflow_requirements() for use with Workflow Field API.
- */
- function workflow_requirements($phase) {
- $requirements = array();
- switch ($phase) {
- case 'install':
- break;
- case 'update':
- break;
- case 'runtime':
- // Show info on admin/reports/status.
- $types = db_query('SELECT wid, type FROM {workflow_type_map} WHERE wid <> 0 ORDER BY type')->fetchAllKeyed();
- // If there are no types, then just bail.
- if (count($types) == 0) {
- return;
- }
- // Let's make it look nice.
- if (count($types) == 1) {
- $type_list = current($types);
- }
- else {
- $last = array_pop($types);
- if (count($types) > 2) {
- $type_list = implode(', ', $types) . ', and ' . $last;
- }
- else {
- $type_list = current($types) . ' and ' . $last;
- }
- }
- $t = get_t();
- $requirements['workflow'] = array(
- 'title' => $t('Workflow'),
- 'value' => $t('Workflow is active on the @types content types.', array('@types' => $type_list)),
- 'severity' => REQUIREMENT_OK,
- );
- break;
- }
- return $requirements;
- }
- /**
- * Implements hook_schema().
- */
- function workflow_schema() {
- $schema['workflows'] = array(
- 'description' => 'Workflows',
- 'fields' => array(
- 'wid' => array(
- 'description' => 'The primary identifier for a workflow.',
- 'type' => 'serial',
- 'not null' => TRUE,
- ),
- 'name' => array(
- 'description' => 'The machine-readable name of this workflow.',
- 'type' => 'varchar',
- 'length' => '255',
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'label' => array(
- 'description' => 'The human-readable name of this workflow.',
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '',
- 'translatable' => TRUE,
- ),
- 'status' => array(
- 'type' => 'int',
- 'not null' => TRUE,
- // Set the default to ENTITY_CUSTOM without using the constant as it is
- // not safe to use it at this point.
- 'default' => 0x01,
- 'size' => 'tiny',
- 'description' => 'The exportable status of the entity.',
- ),
- 'module' => array(
- 'description' => 'The name of the providing module if the entity has been defined in code.',
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => FALSE,
- ),
- 'tab_roles' => array(
- 'description' => 'The role IDs that can access the workflow tabs on node pages.',
- 'type' => 'varchar',
- 'length' => '255',
- 'not null' => TRUE,
- 'default' => '',
- 'serialize' => TRUE,
- ),
- 'options' => array(
- 'description' => 'Additional settings for the workflow.',
- 'type' => 'text',
- 'size' => 'big',
- 'not null' => FALSE,
- 'serialize' => TRUE,
- ),
- ),
- 'primary key' => array('wid'),
- 'unique keys' => array('name' => array('name')),
- );
- $schema['workflow_type_map'] = array(
- 'fields' => array(
- 'type' => array(
- 'description' => 'The {node_type}.type the workflow is used on.',
- 'type' => 'varchar',
- 'length' => '255',
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'wid' => array(
- 'description' => 'The {workflows}.wid this record affects.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- 'disp-width' => '10',
- ),
- ),
- 'indexes' => array(
- 'type' => array('type', 'wid'),
- ),
- );
- $schema['workflow_transitions'] = array(
- 'fields' => array(
- 'tid' => array(
- 'description' => 'The primary identifier for a workflow transition.',
- 'type' => 'serial',
- 'not null' => TRUE,
- ),
- 'name' => array(
- 'description' => 'The machine-readable name of this transition.',
- 'type' => 'varchar',
- 'length' => '32',
- // 'not null' => TRUE,
- 'default' => '',
- ),
- 'label' => array(
- 'description' => 'The human-readable name of this transition.',
- 'type' => 'varchar',
- 'length' => '128',
- 'not null' => TRUE,
- 'default' => '',
- 'translatable' => TRUE,
- ),
- 'sid' => array(
- 'description' => 'The {workflow_states}.sid start state.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- 'disp-width' => '10',
- ),
- 'target_sid' => array(
- 'description' => 'The {workflow_states}.sid target state.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- 'disp-width' => '10',
- ),
- 'roles' => array(
- 'description' => 'The {role}.sid that a user must have to perform transition.',
- 'type' => 'varchar',
- 'length' => '255',
- 'not null' => FALSE,
- 'serialize' => TRUE,
- ),
- ),
- 'primary key' => array('tid'),
- 'indexes' => array(
- 'sid' => array('sid'),
- 'target_sid' => array('target_sid'),
- ),
- );
- $schema['workflow_states'] = array(
- 'fields' => array(
- 'sid' => array(
- 'description' => 'The primary identifier for a workflow state.',
- 'type' => 'serial',
- 'not null' => TRUE,
- ),
- 'wid' => array(
- 'description' => 'The {workflows}.wid this state is part of.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- 'disp-width' => '10',
- ),
- 'name' => array(
- 'description' => 'The machine-readable name of this state.',
- 'type' => 'varchar',
- 'length' => '255',
- // 'not null' => TRUE,
- 'default' => '',
- ),
- 'state' => array(
- 'description' => 'The human-readable name of this state.',
- 'type' => 'varchar',
- 'length' => '255',
- 'not null' => TRUE,
- 'default' => '',
- 'translatable' => TRUE,
- ),
- 'weight' => array(
- 'description' => 'The weight (order) of the state.',
- 'type' => 'int',
- 'size' => 'tiny',
- 'not null' => TRUE,
- 'default' => 0,
- 'disp-width' => '4',
- ),
- 'sysid' => array(
- 'description' => 'The type of state, usually either WORKFLOW_CREATION or empty.',
- 'type' => 'int',
- 'size' => 'tiny',
- 'not null' => TRUE,
- 'default' => 0,
- 'disp-width' => '4',
- ),
- 'status' => array(
- 'description' => 'Whether the current state is active still.',
- 'type' => 'int',
- 'size' => 'tiny',
- 'not null' => TRUE,
- 'default' => 1,
- 'disp-width' => '4',
- ),
- ),
- 'primary key' => array('sid'),
- 'indexes' => array(
- 'sysid' => array('sysid'),
- 'wid' => array('wid'),
- ),
- );
- $schema['workflow_scheduled_transition'] = array(
- 'fields' => array(
- 'tid' => array(
- 'description' => 'The unique ID for this record.',
- 'type' => 'serial',
- 'not null' => TRUE,
- ),
- 'entity_type' => array(
- 'description' => 'The type of entity this transition belongs to.',
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'nid' => array(
- 'description' => 'The entity ID of the object this transition belongs to.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- 'disp-width' => '10',
- ),
- 'field_name' => array(
- 'description' => 'The name of the field the transition relates to.',
- 'type' => 'varchar',
- 'length' => 32,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'language' => array(
- 'description' => 'The {languages}.language of the entity.',
- 'type' => 'varchar',
- 'length' => 32,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'delta' => array(
- 'description' => 'The sequence number for this data item, used for multi-value fields',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'old_sid' => array(
- 'description' => 'The {workflow_states}.sid this state starts at.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- 'disp-width' => '10',
- ),
- 'sid' => array(
- 'description' => 'The {workflow_states}.sid this state transitions to.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- 'disp-width' => '10',
- ),
- 'uid' => array(
- 'description' => 'The user who scheduled this state transition.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- 'disp-width' => '10',
- ),
- 'scheduled' => array(
- 'description' => 'The date this transition is scheduled for.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- 'disp-width' => '10',
- ),
- 'comment' => array(
- 'description' => 'The comment explaining this transition.',
- 'type' => 'text',
- 'size' => 'big',
- 'not null' => FALSE,
- ),
- ),
- 'primary key' => array('tid'),
- 'indexes' => array(
- 'entity_type' => array('entity_type'),
- 'entity_id' => array('entity_type', 'nid'),
- ),
- );
- $schema['workflow_node_history'] = array(
- 'fields' => array(
- 'hid' => array(
- 'description' => 'The unique ID for this record.',
- 'type' => 'serial',
- 'not null' => TRUE,
- ),
- 'entity_type' => array(
- 'description' => 'The type of entity this transition belongs to.',
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'nid' => array(
- 'description' => 'The {node}.nid this record is for.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- 'disp-width' => '10',
- ),
- 'revision_id' => array(
- 'description' => 'The current version identifier.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => FALSE,
- 'default' => NULL,
- ),
- 'field_name' => array(
- 'description' => 'The name of the field the transition relates to.',
- 'type' => 'varchar',
- 'length' => 32,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'language' => array(
- 'description' => 'The {languages}.language of the entity.',
- 'type' => 'varchar',
- 'length' => 32,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'delta' => array(
- 'description' => 'The sequence number for this data item, used for multi-value fields',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'old_sid' => array(
- 'description' => 'The {workflow_states}.sid this transition started as.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- 'disp-width' => '10',
- ),
- 'sid' => array(
- 'description' => 'The {workflow_states}.sid this transition transitioned to.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- 'disp-width' => '10',
- ),
- 'uid' => array(
- 'description' => 'The {users}.uid who made this transition.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- 'disp-width' => '10',
- ),
- 'stamp' => array(
- 'description' => 'The unique stamp for this transition.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- 'disp-width' => '10',
- ),
- 'comment' => array(
- 'description' => 'The comment explaining this transition.',
- 'type' => 'text',
- 'size' => 'big',
- 'not null' => FALSE,
- ),
- ),
- 'primary key' => array('hid'),
- 'indexes' => array(
- 'sid' => array('entity_type', 'nid', 'sid'),
- 'nid' => array('nid'),
- ),
- );
- $schema['workflow_node'] = array(
- 'fields' => array(
- 'nid' => array(
- 'description' => 'The {node}.nid this record is for.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- 'disp-width' => '10',
- ),
- 'sid' => array(
- 'description' => 'The {workflow_states}.sid that this node is currently in.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- 'disp-width' => '10',
- ),
- 'uid' => array(
- 'description' => 'The {users}.uid who triggered this state.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- 'disp-width' => '10',
- ),
- 'stamp' => array(
- 'description' => 'The unique stamp for the transition.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- 'disp-width' => '11',
- ),
- ),
- 'primary key' => array('nid'),
- 'indexes' => array(
- 'nid' => array('nid', 'sid'),
- ),
- );
- return $schema;
- }
- /**
- * Require highest 6.x release.
- */
- function workflow_update_last_removed() {
- return 6101;
- }
- /**
- * Table update from 6 to 7.
- *
- * Adding a unique key for fields (already held unique in code).
- */
- function workflow_update_7000() {
- if (!db_index_exists('workflows', 'name')) {
- db_add_unique_key('workflows', 'name', array('name'));
- }
- if (!db_index_exists('workflow_states', 'wid_state')) {
- db_add_unique_key('workflow_states', 'wid_state', array('wid', 'state'));
- }
- }
- /**
- * Add userid to scheduled transition table.
- */
- function workflow_update_7002() {
- db_add_field('workflow_scheduled_transition', 'uid', array(
- 'description' => 'The user who scheduled this state transition.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- 'disp-width' => '10',
- 'initial' => 0,
- ));
- }
- /**
- * Add Entity field capabilities to workflow_scheduled_transition table.
- */
- function workflow_update_7003() {
- $field = array(
- 'description' => 'The type of entity this transition belongs to.',
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '',
- );
- if (!db_field_exists('workflow_scheduled_transition', 'entity_type')) {
- db_add_field('workflow_scheduled_transition', 'entity_type', $field);
- }
- if (!db_field_exists('workflow_node_history', 'entity_type')) {
- db_add_field('workflow_node_history', 'entity_type', $field);
- }
- $field = array(
- 'description' => 'The name of the field the transition relates to.',
- 'type' => 'varchar',
- 'length' => 32,
- 'not null' => TRUE,
- 'default' => '',
- );
- if (!db_field_exists('workflow_scheduled_transition', 'field_name')) {
- db_add_field('workflow_scheduled_transition', 'field_name', $field);
- }
- if (!db_field_exists('workflow_node_history', 'field_name')) {
- db_add_field('workflow_node_history', 'field_name', $field);
- }
- $field = array(
- 'description' => 'The {languages}.language of the entity.',
- 'type' => 'varchar',
- 'length' => 32,
- 'not null' => TRUE,
- 'default' => '',
- );
- if (!db_field_exists('workflow_scheduled_transition', 'language')) {
- db_add_field('workflow_scheduled_transition', 'language', $field);
- }
- if (!db_field_exists('workflow_node_history', 'language')) {
- db_add_field('workflow_node_history', 'language', $field);
- }
- $field = array(
- 'description' => 'The sequence number for this data item, used for multi-value fields',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- );
- if (!db_field_exists('workflow_scheduled_transition', 'delta')) {
- db_add_field('workflow_scheduled_transition', 'delta', $field);
- }
- if (!db_field_exists('workflow_node_history', 'delta')) {
- db_add_field('workflow_node_history', 'delta', $field);
- }
- db_drop_index('workflow_scheduled_transition', 'nid');
- db_drop_index('workflow_scheduled_transition', 'entity_id');
- db_drop_index('workflow_scheduled_transition', 'entity_type');
- db_add_index('workflow_scheduled_transition', 'entity_id', array('entity_type', 'nid'));
- db_add_index('workflow_scheduled_transition', 'entity_type', array('entity_type'));
- db_drop_index('workflow_node_history', 'nid');
- db_drop_index('workflow_node_history', 'sid');
- db_add_index('workflow_node_history', 'sid', array('entity_type', 'nid', 'sid'));
- }
- /**
- * Update scheduled state transitions with no association to "node".
- */
- function workflow_update_7004() {
- db_update('workflow_scheduled_transition')
- ->fields(array(
- 'entity_type' => 'node',
- 'language' => LANGUAGE_NONE,
- 'delta' => '0',
- )
- )
- ->execute();
- }
- /**
- * Enable Workflow Node module. See https:\/\/drupal.org\/node\/2122541 .
- */
- function workflow_update_7005() {
- module_enable(array('workflownode'));
- }
- /**
- * Set historical records with no associated entity to "node".
- *
- * Otherwise, they won't show up in the Workflow tab.
- */
- function workflow_update_7006() {
- db_update('workflow_node_history')
- ->fields(array(
- 'entity_type' => 'node',
- )
- )
- ->condition('entity_type', '')
- ->execute();
- }
- /**
- * Convert roles to entity-like arrays.
- */
- function workflow_update_7007() {
- // For this update, do not use the Workflow API, since some table fields are
- // not present yet. Also, do not move to the 'floating' hook_update_N().
- $schema = workflow_schema();
- // Change length from 60 to 255, to create a 'standard' Roles field,
- // like workflow_transitions-roles.
- $table = 'workflows';
- $fields = $schema[$table]['fields'];
- db_change_field($table, 'tab_roles', 'tab_roles', $fields['tab_roles']);
- // Save field workflows-tab_roles in serialized array (using explode for the last time).
- $query = "SELECT * FROM {workflows} w ";
- $result = db_query($query);
- foreach ($result as $record) {
- // Replace role ID 'author' by '-1'.
- // Update workflow->tab_roles to serializable array.
- $roles = $record->tab_roles;
- // Allow reprocessing this hook, by checking if this is an array.
- if (!(strpos($roles, 'a:') === 0)) {
- $roles = str_replace('author', '-1', $roles);
- $record->tab_roles = empty($roles) ? array() : explode(',', $roles);
- $num_updated = db_update('workflows')
- ->fields(array(
- 'tab_roles' => serialize($record->tab_roles),
- ))
- ->condition('wid', $record->wid, '=')
- ->execute();
- }
- }
- // Save field workflow_transitions-roles in serialized array (using explode for the last time).
- // Replace role ID 'author' by '-1'.
- $query = "SELECT wt.tid, wt.roles FROM {workflow_transitions} wt";
- $result = db_query($query);
- foreach ($result as $record) {
- $roles = $record->roles;
- // Allow reprocessing this hook, by checking if this is an array.
- if (!(strpos($roles, 'a:') === 0)) {
- $roles = str_replace('author', '-1', $roles);
- $record->roles = empty($roles) ? array() : explode(',', $roles);
- $num_updated = db_update('workflow_transitions')
- ->fields(array(
- 'roles' => serialize($record->roles),
- ))
- ->condition('tid', $record->tid, '=')
- ->execute();
- }
- }
- }
- /**
- * Add Revision to workflow history table.
- *
- * There is no update for current states.
- */
- // function workflow_update_7008() {
- // // This is moved to the general hook_update_N().
- // }
- /**
- * Remove invalid transitions.
- */
- function workflow_update_7014() {
- // Some error in cloning Workflows generated superfluous, invalid Transitions.
- $num_deleted = db_delete('workflow_transitions')
- ->condition('sid', 0)
- ->execute();
- }
- /**
- * Add database fields. Make Workflow entity-aware, exportable.
- */
- function workflow_update_7015() {
- $schema = workflow_schema();
- // Update the Workflow table.
- $table = 'workflows';
- $fields = $schema[$table]['fields'];
- if (!db_field_exists($table, 'label')) {
- db_add_field($table, 'label', $fields['label']);
- }
- if (!db_field_exists($table, 'status')) {
- db_add_field($table, 'status', $fields['status']);
- }
- if (!db_field_exists($table, 'module')) {
- db_add_field($table, 'module', $fields['module']);
- }
- // Update the WorkflowConfigTransitions table.
- $table = 'workflow_transitions';
- $fields = $schema[$table]['fields'];
- if (!db_field_exists($table, 'label')) {
- db_add_field($table, 'label', $fields['label']);
- }
- if (!db_field_exists($table, 'name')) {
- db_add_field($table, 'name', $fields['name']);
- }
- // Update the WorkflowStates table.
- $table = 'workflow_states';
- $fields = $schema[$table]['fields'];
- if (!db_field_exists($table, 'name')) {
- db_add_field($table, 'name', $fields['name']);
- }
- // Update the WorkflowHistory table.
- $table = 'workflow_node_history';
- $fields = $schema[$table]['fields'];
- // This is moved from hook_update_7008().
- if (!db_field_exists($table, 'revision_id')) {
- db_add_field($table, 'revision_id', $fields['revision_id']);
- }
- // Load&save workflows, to populate the label.
- // Do this after all db-updates!!
- // Do not use workflow_*() functions.
- foreach (entity_load('Workflow') as $workflow) {
- $workflow->save();
- // Load&save workflow states, to populate the state name.
- foreach ($workflow->getStates(TRUE, TRUE) as $state) {
- $state->save();
- }
- }
- // The update system is going to flush all caches,
- // including the updated Rules Action, so nothing to do here.
- }
- /**
- * Add an index to {workflow_node_history}.nid.
- */
- function workflow_update_7016() {
- if (db_field_exists('workflow_node_history', 'nid') && !db_index_exists('workflow_node_history', 'nid')) {
- db_add_index('workflow_node_history', 'nid', array('nid'));
- }
- }
- /**
- * Add/correct a primary key to {workflow_scheduled_transition}.
- */
- function workflow_update_7017() {
- // Drop existing primary key.
- db_drop_primary_key('workflow_scheduled_transition');
- // Add new primary key.
- $spec = array(
- 'type' => 'serial',
- 'not null' => TRUE,
- );
- $keys_new = array(
- 'primary key' => array('tid'),
- );
- if (!db_field_exists('workflow_scheduled_transition', 'tid') ) {
- db_add_field('workflow_scheduled_transition', 'tid', $spec, $keys_new);
- }
- else {
- db_change_field('workflow_scheduled_transition', 'tid', 'tid', $spec, $keys_new);
- }
- return t('Added tid primary key to {workflow_scheduled_transition}');
- }
- /**
- * Enable the List module, newly added as a dependency.
- */
- function workflow_update_7200() {
- module_enable(array('list'));
- }
|