You are here

function workbench_moderation_update_7009 in Workbench Moderation 7.3

Same name and namespace in other branches
  1. 7 workbench_moderation.install \workbench_moderation_update_7009()

Add new fields to workbench_moderation_transitions table.

File

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

Code

function workbench_moderation_update_7009() {
  $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',
    ),
  );

  // Add index too.
  $index = array(
    'primary key' => array(
      'id',
    ),
  );
  db_add_field('workbench_moderation_transitions', 'id', $fields['id'], $index);
  db_add_field('workbench_moderation_transitions', 'name', $fields['name']);

  // Fill in the blanks.
  db_update('workbench_moderation_transitions')
    ->expression('name', "CONCAT(from_name, '-', to_name)")
    ->execute();
}