You are here

function entity_translation_upgrade_update_7001 in Entity Translation 7

Implements hook_update_N().

Adds the 'complete' column to the history table.

File

entity_translation_upgrade/entity_translation_upgrade.install, line 61
Schema declaration for the entity_translation_upgrade module.

Code

function entity_translation_upgrade_update_7001() {
  $table = 'entity_translation_upgrade_history';
  $name = 'complete';

  // Add the 'complete' field.
  $spec = array(
    'description' => 'Boolean indicating whether the node migration has completed.',
    'type' => 'int',
    'not null' => TRUE,
    'default' => 0,
  );
  db_add_field($table, $name, $spec);

  // Add the 'complete' index.
  db_add_index($table, $name, array(
    $name,
  ));

  // Existing records are supposed to concern already completed migrations.
  db_update($table)
    ->fields(array(
    'complete' => 1,
  ))
    ->execute();
}