Browse Source

Merge branch '7.x-3.x' of github.com:tripal/tripal into 7.x-3.x

Stephen Ficklin 8 years ago
parent
commit
fe2756af52

+ 8 - 0
tripal_chado/includes/tripal_chado.migrate.inc

@@ -940,6 +940,10 @@ function tripal_chado_migrate_get_biodata_tables ($chado_table) {
 }
 
 function tripal_chado_migrate_resource_blocks($bundle_name) {
+  // Do not try to migrate resouce blocks and titles if they weren't set up
+  if (!db_table_exists('field_revision_field_resource_titles') || !db_table_exists('field_revision_field_resource_blocks')) {
+    return;
+  }
   $entites =
     db_select('chado_' . $bundle_name, 'B')
     ->fields('B', array('nid'))
@@ -1071,6 +1075,10 @@ function tripal_chado_migrate_resource_blocks($bundle_name) {
 }
 
 function tripal_chado_migrate_resource_links($bundle_name) {
+  // Do not try to migrate resouce blocks and titles if they weren't set up
+  if (!db_table_exists('field_revision_field_resource_links')) {
+    return;
+  }
   $entites =
   db_select('chado_' . $bundle_name, 'B')
   ->fields('B', array('nid'))

+ 7 - 4
tripal_chado/tripal_chado.install

@@ -313,7 +313,7 @@ function tripal_chado_upgrade_v2_v3_pre_enable() {
     if (db_query("SELECT 1 FROM pg_indexes WHERE indexname = 'tripal_cv_obo_pkey'")->fetchField()) {
       $sql = "ALTER INDEX tripal_cv_obo_pkey RENAME TO tripal_cv_obo_pkey2";
     }
-    if (db_query("SELECT 1 FROM pg_indexes WHERE indexname = 'tripal_cv_obo_tripal_cv_obo_idx1_idx'")->fetchField()) {
+    else if (db_query("SELECT 1 FROM pg_indexes WHERE indexname = 'tripal_cv_obo_tripal_cv_obo_idx1_idx'")->fetchField()) {
       $sql = "ALTER INDEX tripal_cv_obo_tripal_cv_obo_idx1_idx RENAME TO tripal_cv_obo_tripal_cv_obo_idx1_idx2";
     }
     else {
@@ -386,9 +386,12 @@ function tripal_chado_upgrade_v2_v3_enable() {
     db_query($sql);
     $sql = "ALTER INDEX tripal_cv_obo_obo_id_idx2 RENAME TO tripal_cv_obo_obo_id_idx";
     db_query($sql);
-    $sql = "ALTER INDEX tripal_cv_obo_pkey2 RENAME TO tripal_cv_obo_pkey";
-    db_query($sql);
-    $sql = "ALTER INDEX tripal_cv_obo_tripal_cv_obo_idx1_idx2 RENAME TO tripal_cv_obo_tripal_cv_obo_idx1_idx";
+    if (db_query("SELECT 1 FROM pg_indexes WHERE indexname = 'tripal_cv_obo_pkey2'")->fetchField()) {
+      $sql = "ALTER INDEX tripal_cv_obo_pkey2 RENAME TO tripal_cv_obo_pkey";
+    } 
+    else {
+      $sql = "ALTER INDEX tripal_cv_obo_tripal_cv_obo_idx1_idx2 RENAME TO tripal_cv_obo_tripal_cv_obo_idx1_idx";
+    }
     db_query($sql);
   }