mview_id); } } // Get the list of nodes to remove $sql_lib_id = "SELECT nid, vid ". "FROM {node} ". "WHERE type='chado_library'"; $result = db_query($sql_lib_id); while ($node = db_fetch_object($result)) { node_delete($node->nid); } } /** * This function simply defines all tables needed for the module to work * correctly. By putting the table definitions in a separate function we * can easily provide the entire list for hook_install or individual * tables for an update. * * @ingroup tripal_library */ function tripal_library_get_schemas() { $schema = array(); $schema['chado_library'] = 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 ), 'library_id' => array( 'type' => 'int', 'not null' => TRUE, 'default' => 0 ) ), 'indexes' => array( 'library_id' => array('library_id') ), 'unique keys' => array( 'nid_vid' => array('nid', 'vid'), 'vid' => array('vid') ), 'primary key' => array('nid'), ); return $schema; } /** * Implementation of hook_requirements(). */ function tripal_library_requirements($phase) { $requirements = array(); if ($phase == 'install') { // make sure chado is installed if (!tripal_core_is_chado_installed()) { $requirements ['tripal_library'] = array( 'title' => "tripal_library", 'value' => "ERROR: Chado most be installed before this module can be enabled", 'severity' => REQUIREMENT_ERROR, ); } } return $requirements; } /* * */ function tripal_library_add_cvterms() { // Insert cvterm 'library_description' into cvterm table of chado // database. This CV term is used to keep track of the library // description in the libraryprop table. tripal_cv_add_cvterm(array('name' => 'library_description', 'def' => 'Description of a library'), 'tripal', 0, 1, 'tripal'); // add cvterms for the map unit types tripal_cv_add_cvterm(array('name' => 'cdna_library','def' => 'cDNA library'), 'tripal_library_types', 0, 1, 'tripal'); tripal_cv_add_cvterm(array('name' => 'bac_library','def' => 'Bacterial Artifical Chromsome (BAC) library'), 'tripal_library_types', 0, 1, 'tripal'); tripal_cv_add_cvterm(array('name' => 'fosmid_library','def' => 'Fosmid library'), 'tripal_library_types', 0, 1, 'tripal'); tripal_cv_add_cvterm(array('name' => 'cosmid_library','def' => 'Cosmid library'), 'tripal_library_types', 0, 1, 'tripal'); tripal_cv_add_cvterm(array('name' => 'yac_library','def' => 'Yeast Artificial Chromosome (YAC) library'), 'tripal_library_types', 0, 1, 'tripal'); tripal_cv_add_cvterm(array('name' => 'genomic_library','def' => 'Genomic Library'), 'tripal_library_types', 0, 1, 'tripal'); } /** * Update for Drupal 6.x, Tripal 1.0 * This update * - adds the library types * * @ingroup tripal_library */ function tripal_library_update_6000() { // add in the missing library typ cv terms tripal_library_add_cvterms(); return $ret; }