Browse Source

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

ccheng 9 years ago
parent
commit
b3471a94bc
2 changed files with 48 additions and 6 deletions
  1. 16 4
      README.txt
  2. 32 2
      tripal_chado/tripal_chado.install

+ 16 - 4
README.txt

@@ -31,6 +31,7 @@ Required Modules
  - Drupal contributed modules: Views
  - Database containing GMOD Chado Schema (can be installed by the 
    Tripal Core module)
+   
 NOTE: A PostgreSQL database is required for installation of the 
 Chado Schema
 
@@ -44,19 +45,30 @@ Upgrade from Tripal v2.x to v3.x
 ---------------------------------
 Note:  Upgrade can only be performed using 'drush' command.
 
+Note: Deprecated API functions from Tripal v1.x have been removed from Tripal
+v3.  Therefore, use of deprecated API functions in templates or custom 
+modules may cause a white screen of death (WSOD).  Check teh server logs if this
+occurs to find where deprecated functions may be used.
+
+Upgrade Instructions:
+
 Step 1: Put the site in maintenance mode.
 Step 2: Remove old Tripal v2 package and replace with Tripal v3 package
 Step 3: Enable the tripal module
 
   drush pm-enable tripal
  
-Step 4:  
+Step 4: Enable the tripal_chado module  
 
   drush pm-enable tripal_chado
+  
+Step 5:  Apply updates
+
+  drush updatedb
+  
+Step 6:  Return to your Tripal site, and click the link that appears for
+preparing Chado and launch the job.
 
-Note: Use of deprecated API functions from Tripal v1 will cause a template
-to not work because Tripal v1 deprecated API fucntions have been removed
-in Tripal v3.
 
 Customization
 --------------

+ 32 - 2
tripal_chado/tripal_chado.install

@@ -499,5 +499,35 @@ function tripal_chado_chado_entity_schema() {
  * Moves vocabulary terms from the 'tripal' vocabulary to the 'local' vocabulary.
  */
 function tripal_chado_update_7300() {
-  // Move all terms in the 'tripal' cv' over to 'local'.
-}
+  try {
+
+    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);
+  }
+  catch (\PDOException $e) {
+    $error = $e->getMessage();
+    throw new DrupalUpdateException('Failed to complete update' . $error);
+  }}