Browse Source

Added missing update to tripal_ds. Added a temp fix for adding properties

Stephen Ficklin 7 years ago
parent
commit
21a3d6b027
2 changed files with 36 additions and 11 deletions
  1. 13 11
      tripal_chado/includes/tripal_chado.fields.inc
  2. 23 0
      tripal_ds/tripal_ds.install

+ 13 - 11
tripal_chado/includes/tripal_chado.fields.inc

@@ -1614,17 +1614,19 @@ function tripal_chado_bundle_instances_info_linker(&$info, $entity_type, $bundle
      $pkey = $schema['primary key'][0];
      // Get the list of existing property types for this table.
      $args = array();
-      $sql = "
-        SELECT DISTINCT P.type_id
-        FROM {" . $prop_table . "} P
-      ";
-      if (array_key_exists('type_id', $tschema['fields'])) {
-        $sql .= "
-            INNER JOIN {" . $table_name . "} T on T.$tpkey = P.$tpkey
-          WHERE T.type_id = :cvterm_id
-        ";
-        $args[':cvterm_id'] = $cvterm_id;
-      }
+     $sql = 'SELECT DISTINCT type_id FROM {' . $prop_table . '}';
+
+//       $sql = "
+//         SELECT DISTINCT P.type_id
+//         FROM {" . $prop_table . "} P
+//       ";
+//       if (array_key_exists('type_id', $tschema['fields'])) {
+//         $sql .= "
+//             INNER JOIN {" . $table_name . "} T on T.$tpkey = P.$tpkey
+//           WHERE T.type_id = :cvterm_id
+//         ";
+//         $args[':cvterm_id'] = $cvterm_id;
+//       }
 
      $props = chado_query($sql, $args);
      while ($prop = $props->fetchObject()) {

+ 23 - 0
tripal_ds/tripal_ds.install

@@ -38,8 +38,31 @@ function tripal_ds_schema() {
         'not null' => TRUE,
         'default' => ''
       ),
+      'weight' => array(
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 1,
+      ),
     ),
     'primary key' => array('id'),
   );
   return $schema;
 }
+
+/**
+ * Add a weight column to the tripal_ds table.
+ */
+function tripal_ds_update_7300() {
+  try {
+    db_add_field('tripal_ds', 'weight', array(
+      'type' => 'int',
+      'not null' => TRUE,
+      'default' => 1,
+    ));
+  }
+  catch (\PDOException $e) {
+    $transaction->rollback();
+    $error = $e->getMessage();
+    throw new DrupalUpdateException('Could not perform update: '. $error);
+  }
+}