You are here

function views_update_6009 in Views (for Drupal 7) 6.2

Same name and namespace in other branches
  1. 6.3 views.install \views_update_6009()
  2. 7.3 views.install \views_update_6009()

File

./views.install, line 430
views.install Contains install and update functions for Views.

Code

function views_update_6009() {
  $ret = array();
  $schema = views_schema_6009();
  if ($GLOBALS['db_type'] == 'pgsql') {
    $ret[] = update_sql('ALTER TABLE {views_display} RENAME "display_options" TO "display_options_old"');
    db_add_field($ret, 'views_display', 'display_options', $schema['views_display']['fields']['display_options']);
    $sql = "SELECT vid, id, display_options_old FROM {views_display}";
    $result = db_query($sql);
    while ($row = db_fetch_array($result)) {
      $row['display_options_old'] = db_decode_blob($row['display_options_old']);
      $sql = "UPDATE {views_display} SET display_options = '%s' WHERE vid = %d AND id = '%s'";
      db_query($sql, $row['display_options_old'], $row['vid'], $row['id']);
    }
    db_drop_field($ret, 'views_display', 'display_options_old');
  }
  else {
    db_change_field($ret, 'views_display', 'display_options', 'display_options', $schema['views_display']['fields']['display_options']);
  }
  return $ret;
}