You are here

function views_update_12 in Views (for Drupal 7) 5

File

./views.install, line 421

Code

function views_update_12() {
  $ret = array();
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_add_column($ret, 'view_view', 'is_cacheable', 'int(1)');
      break;
    case 'pgsql':
      db_add_column($ret, 'view_view', 'is_cacheable', 'smallint');
      break;
  }
  views_make_cache_table($ret);
  include_once './' . drupal_get_path('module', 'views') . '/views.module';
  $result = db_query("SELECT name FROM {view_view} ORDER BY name");
  while ($row = db_fetch_array($result)) {
    $view = views_get_view($row['name']);
    $ret[] = update_sql("UPDATE {view_view} SET is_cacheable = " . (_views_is_cacheable($view) ? "1" : "0") . " WHERE vid = " . $view->vid);
  }
  $ret[] = update_sql("ALTER TABLE {view_view} DROP query");
  $ret[] = update_sql("ALTER TABLE {view_view} DROP countquery");
  views_make_cache_table($ret);
  return $ret;
}