Jelajahi Sumber

Fixed formatting of install schema

spficklin 11 tahun lalu
induk
melakukan
babff5a3cb
2 mengubah file dengan 28 tambahan dan 12 penghapusan
  1. 22 7
      tripal_contact/tripal_contact.install
  2. 6 5
      tripal_pub/tripal_pub.install

+ 22 - 7
tripal_contact/tripal_contact.install

@@ -10,10 +10,15 @@
  * multiple contact/mysql instances as well as manage and create such contact instances
  */
 
+
 /**
  * Implementation of hook_install().
  */
 function tripal_contact_install() {
+	
+	// create the module's data directory
+  tripal_create_moddir('tripal_contact');
+  
   // add the tripal_contact table to Drupal
   drupal_install_schema('tripal_contact');
   
@@ -39,22 +44,32 @@ function tripal_contact_uninstall() {
 function tripal_contact_schema() {
   $schema['chado_contact'] = array(
     'fields' => array(
-      'nid' => array(
+      'vid' => array(
         'type' => 'int',
         'unsigned' => TRUE,
         'not null' => TRUE,
+        'default' => 0
       ),
-      'vid' => array(
-          'type' => 'int',
-          'not null' => TRUE,
-      ),
-      'contact_id' => array(
+      'nid' => array(
         'type' => 'int',
         'unsigned' => TRUE,
         'not null' => TRUE,
+        'default' => 0
       ),
+      'contact_id' => array(
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0
+      )
+    ),
+    'indexes' => array(
+      'contact_id' => array('contact_id')
+    ),
+    'unique keys' => array(
+      'nid_vid' => array('nid', 'vid'),
+      'vid' => array('vid')
     ),
-    'primary key' => array('nid', 'vid', 'contact_id'),
+    'primary key' => array('nid'),
   );
   return $schema;
 }

+ 6 - 5
tripal_pub/tripal_pub.install

@@ -59,16 +59,17 @@ function tripal_pub_schema() {
       'nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
       'pub_id' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
       'sync_date' => array('type' => 'int', 'not null' => FALSE, 'description' => 'UNIX integer sync date/time'),
-  ),
+    ),
     'indexes' => array(
       'pub_id' => array('pub_id')
-  ),
+    ),
     'unique keys' => array(
       'nid_vid' => array('nid', 'vid'),
       'vid' => array('vid')
-  ),
+    ),
     'primary key' => array('nid'),
   );
+  
   $schema['tripal_pub_import'] = array(
     'fields' => array(
       'pub_import_id' => array('type' => 'serial', 'not null' => TRUE),
@@ -76,11 +77,11 @@ function tripal_pub_schema() {
       'criteria' => array('type' => 'text', 'size' => 'normal', 'not null' => TRUE, 'description' => 'Contains a serialized PHP array containing the search criteria'),
       'disabled'  => array('type' => 'int', 'unsigned' => TRUE, 'not NULL' => TRUE, 'default' => 0),      
       'do_contact'  => array('type' => 'int', 'unsigned' => TRUE, 'not NULL' => TRUE, 'default' => 0),
-  ),
+    ),
     'primary key' => array('pub_import_id'),
     'indexes' => array(
       'name' => array('name')
-  ),
+    ),
   );
    
   return $schema;