Browse Source

Fix to Chado install

Stephen Ficklin 8 years ago
parent
commit
e378340fe8
1 changed files with 28 additions and 26 deletions
  1. 28 26
      tripal_chado/tripal_chado.install

+ 28 - 26
tripal_chado/tripal_chado.install

@@ -10,33 +10,35 @@ function tripal_chado_install() {
 //       ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED
 //   ');
 
-  // For an upgraded site we need to move some vocabulary terms over
-  // to the new 'local' vocabulary:
-  tripal_insert_db(array(
-    'name' => 'local',
-    'description' => variable_get('site_name', 'This site.'),
-  ));
-
-  // Move the library properties out of the tripal database and into the
-  // local database.
-  $sql = "
-    UPDATE {dbxref}
-      SET db_id = (SELECT db_id FROM {db} WHERE name = 'local')
-    WHERE dbxref_id IN (
-      SELECT DISTINCT CVT.dbxref_id
-      FROM {cvterm} CVT
-        INNER JOIN {cv} CV ON CV.cv_id = CVT.cv_id
-      WHERE CV.name IN (
-        'library_property',
-        'library_type',
-        'project_property',
-        'nd_experiment_types',
-        'nd_geolocation_property',
-        'tripal_analysis'
+  if (chado_is_installed()) {
+    // For an upgraded site we need to move some vocabulary terms over
+    // to the new 'local' vocabulary:
+    tripal_insert_db(array(
+      'name' => 'local',
+      'description' => variable_get('site_name', 'This site.'),
+    ));
+
+    // Move the library properties out of the tripal database and into the
+    // local database.
+    $sql = "
+      UPDATE {dbxref}
+        SET db_id = (SELECT db_id FROM {db} WHERE name = 'local')
+      WHERE dbxref_id IN (
+        SELECT DISTINCT CVT.dbxref_id
+        FROM {cvterm} CVT
+          INNER JOIN {cv} CV ON CV.cv_id = CVT.cv_id
+        WHERE CV.name IN (
+          'library_property',
+          'library_type',
+          'project_property',
+          'nd_experiment_types',
+          'nd_geolocation_property',
+          'tripal_analysis'
+        )
       )
-    )
-  ";
-  chado_query($sql);
+    ";
+    chado_query($sql);
+  }
 }
 
 /**