"tripal_contact", 'value' => "ERROR: Chado most be installed before this module can be enabled", 'severity' => REQUIREMENT_ERROR, ); } } return $requirements; } /** * Implementation of hook_install(). */ function tripal_contact_install() { // create the module's data directory tripal_create_moddir('tripal_contact'); // add the contactprop table to Chado tripal_contact_add_custom_tables(); // add loading of the the tripal contact ontology to the job queue $obo_path = realpath('./') . '/' . drupal_get_path('module', 'tripal_contact') . '/files/tcontact.obo'; $obo_id = tripal_cv_add_obo_ref('Tripal Contacts', $obo_path); tripal_cv_submit_obo_job($obo_id); } /** * Implementation of hook_uninstall(). */ function tripal_contact_uninstall() { } /** * Implementation of hook_schema(). */ function tripal_contact_schema() { $schema['chado_contact'] = array( 'fields' => array( 'vid' => array( 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0 ), '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'), ); return $schema; } /* * */ function tripal_contact_add_custom_tables(){ $schema = array ( 'table' => 'contactprop', 'fields' => array ( 'contactprop_id' => array ( 'type' => 'serial', 'not null' => true, ), 'contact_id' => array ( 'type' => 'int', 'not null' => true, ), 'type_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 => 'contactprop_id', ), 'unique keys' => array ( 'contactprop_c1' => array ( 0 => 'contact_id', 1 => 'type_id', 2 => 'rank', ), ), 'indexes' => array ( 'contactprop_idx1' => array ( 0 => 'contact_id', ), 'contactprop_idx2' => array ( 0 => 'type_id', ), ), 'foreign keys' => array ( 'cvterm' => array ( 'table' => 'cvterm', 'columns' => array ( 'type_id' => 'cvterm_id', ), ), 'contact' => array ( 'table' => 'contact', 'columns' => array ( 'contact_id' => 'contact_id', ), ), ), ); tripal_core_create_custom_table('contactprop', $schema, TRUE); }