You are here

function block_revisions_update_7000 in Block Revisions 7

Change {boxes_revisions}.format into varchar.

File

./block_revisions.install, line 122
Installation routines for the Block Revisions module.

Code

function block_revisions_update_7000() {
  db_change_field('boxes_revisions', 'format', 'format', array(
    'type' => 'varchar',
    'length' => 255,
    'not null' => FALSE,
    'description' => 'The {filter_format}.format of the block body.',
  ));
  $existing_formats = db_query("SELECT format FROM {filter_format}")
    ->fetchCol();
  $default_format = variable_get('filter_fallback_format', 1);
  db_update('boxes_revisions')
    ->fields(array(
    'format' => $default_format,
  ))
    ->isNotNull('format')
    ->condition('format', $existing_formats, 'NOT IN')
    ->execute();
}