You are here

function entityqueue_update_7000 in Entityqueue 7

Add "language" column to all entityqueue tables.

File

./entityqueue.install, line 197
Install, update and uninstall functions for the Entityqueue module.

Code

function entityqueue_update_7000() {

  // Update the existing entities, with the default language.
  $langcode = language_default()->language;

  // Add column to main queue table and update existing queues.
  $column = array(
    'description' => 'The {languages}.language of this queue.',
    'type' => 'varchar',
    'length' => 12,
    'not null' => TRUE,
    'default' => '',
  );
  db_add_field('entityqueue_queue', 'language', $column);
  db_update('entityqueue_queue')
    ->fields(array(
    'language' => $langcode,
  ))
    ->execute();

  // Add column to subqueue table and update existing subqueues.
  $column = array(
    'description' => 'The {languages}.language of this subqueue.',
    'type' => 'varchar',
    'length' => 12,
    'not null' => TRUE,
    'default' => '',
  );
  db_add_field('entityqueue_subqueue', 'language', $column);
  db_update('entityqueue_subqueue')
    ->fields(array(
    'language' => $langcode,
  ))
    ->execute();
}