Browse Source

Fixed bugs with creation of materialized views

spficklin 12 years ago
parent
commit
f374687cbb
2 changed files with 5 additions and 4 deletions
  1. 3 2
      tripal_core/includes/custom_tables.php
  2. 2 2
      tripal_core/includes/mviews.php

+ 3 - 2
tripal_core/includes/custom_tables.php

@@ -132,8 +132,9 @@ function tripal_core_create_custom_table(&$ret, $table, $schema, $skip_creation
   }  
 
   // if the table exists in Chado and in our custom table and
-  // skip creation is turned off then drop and re-create the table
-  if ($exists and $centry and !$skip_creation) {
+  // skip creation is turned off then drop and re-create the table 
+  if ($exists and is_object($centry) and !$skip_creation) {    
+    
     // drop the table we'll recreate it with the new schema
     $previous_db = tripal_db_set_active('chado');  // use chado database
     db_drop_table($ret, $table);

+ 2 - 2
tripal_core/includes/mviews.php

@@ -92,7 +92,7 @@ function tripal_add_mview($name, $modulename, $mv_table, $mv_specs, $indexed,
     // create the table differently depending on if it the traditional method
     // or the Drupal Schema API method
     if ($mv_schema) {
-      if (!tripal_core_create_custom_table ($ret, $mv_table, $schema_arr)) {
+      if (!tripal_core_create_custom_table ($ret, $mv_table, $schema_arr, 0)) {
         drupal_set_message(t("Could not create the materialized view. Check Drupal error report logs."), 'error');
       }
       else {
@@ -208,7 +208,7 @@ function tripal_edit_mview($mview_id, $name, $modulename, $mv_table, $mv_specs,
     // re-create the table differently depending on if it the traditional method
     // or the Drupal Schema API method
     if ($mv_schema) {    	
-      if (!tripal_core_create_custom_table($ret, $mv_table, $schema_arr)) {
+      if (!tripal_core_create_custom_table($ret, $mv_table, $schema_arr, 0)) {
         drupal_set_message(t("Could not create the materialized view. Check Drupal error report logs."));
       }
       else {