function tripal_chado_update_7324

3.x tripal_chado.install tripal_chado_update_7324()

Updating the db2cv materialized view.

File

tripal_chado/tripal_chado.install, line 1494

Code

function tripal_chado_update_7324() {
  try {
    if (chado_table_exists(db2cv_mview) and !chado_column_exists('db2cv_mview', 'num_terms')) {
      module_load_include('inc', 'tripal_chado', 'includes/setup/tripal_chado.chado_vx_x');

      // Remove the old mview.
      $mview_id = chado_get_mview_id('db2cv_mview');
      chado_delete_mview($mview_id);

      // Readd the mview.
      tripal_chado_add_db2cv_mview_mview();
      drupal_set_message('Populating materialized view db2cv_mview...');
      $mview_id = chado_get_mview_id('db2cv_mview');
      chado_populate_mview($mview_id);
    }
  }
  catch (\PDOException $e) {
    $error = $e->getMessage();
    throw new DrupalUpdateException('Could not perform update: ' . $error);
  }
}