فهرست منبع

Added a tripal_bundle_variables table to handle additional bundle information and removed the data serialized array column previously used for this purpose.

Lacey Sanderson 10 سال پیش
والد
کامیت
a95dbdbab6
1فایلهای تغییر یافته به همراه65 افزوده شده و 7 حذف شده
  1. 65 7
      tripal_entities/tripal_entities.install

+ 65 - 7
tripal_entities/tripal_entities.install

@@ -89,6 +89,9 @@ function tripal_entities_schema() {
 
   // Adds a table for managing the TripalEntity entity types (bundles).
   $schema['tripal_bundle'] = tripal_entities_tripal_bundle_schema();
+  
+  // Adds a table for additional information related to bundles.
+  $schema['tripal_bundle_variables'] = tripal_entities_tripal_bundle_variables_schema();
 
   // Links TripalEntity entities to the chado record.
   $schema['chado_entity'] = tripal_entities_chado_entity_schema();
@@ -240,13 +243,6 @@ function tripal_entities_tripal_bundle_schema() {
         'size' => 'tiny',
         'description' => 'The weight of this tripal data type in relation to others.',
       ),
-      'data' => array(
-        'type' => 'text',
-        'not null' => FALSE,
-        'size' => 'big',
-        'serialize' => TRUE,
-        'description' => 'A serialized array of additional data related to this tripal data type.',
-      ),
     ) + entity_exportable_schema_fields(),
     'primary key' => array('id'),
     'unique keys' => array(
@@ -256,6 +252,68 @@ function tripal_entities_tripal_bundle_schema() {
   return $schema;
 }
 
+/**
+ * Additional Tripal Bundle Information.
+ *
+ * This table is used for storing any additonal information describing
+ * a tripal bundle. For example, this is a good place to store title/url formats.
+ */
+function tripal_entities_tripal_bundle_variables_schema() {
+
+  $schema = array(
+    'description' => 'This table is used for storing any additonal information describing
+      a tripal bundle. For example, this is a good place to store title/url formats.',
+    'fields' => array (
+      'bundle_variable_id' => array (
+        'type' => 'serial',
+        'not null' => TRUE,
+      ),
+      'bundle_id' => array (
+        'type' => 'int',
+        'not null' => TRUE,
+      ),
+      'variable_id' => array (
+        'type' => 'int',
+        'not null' => TRUE,
+      ),
+      'value' => array (
+        'type' => 'text',
+        'not null' => FALSE,
+      ),
+      'rank' => array (
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+    ),
+    'primary key' => array (
+      0 => 'bundle_variable_id',
+    ),
+    'unique keys' => array (
+      'tripal_bundle_variables_c1' => array (
+        0 => 'bundle_id',
+        1 => 'variable_id',
+        2 => 'rank',
+      ),
+    ),
+    'indexes' => array (
+      'tripal_bundle_variables_idx1' => array (
+        0 => 'variable_id',
+      ),
+    ),
+    'foreign keys' => array (
+      'tripal_variables' => array (
+        'table' => 'tripal_variables',
+        'columns' => array (
+          'variable_id' => 'variable_id',
+        ),
+      ),
+    ),
+  );
+  
+  return $schema;
+}
+
 /**
  * Links Biological Data Entities to the chado "base" table the data is stored in.
  * This is where we would specify that a particular gene maps to the record in the