|
@@ -340,6 +340,7 @@ function tripal_feature_update_7200() {
|
|
|
// site upgrade when the tripal_core module is disabled.
|
|
|
module_load_include('module', 'tripal_core', 'tripal_core');
|
|
|
tripal_core_import_api();
|
|
|
+ module_load_include('inc', 'tripal_cv', 'api/tripal_cv.api');
|
|
|
|
|
|
// During the upgrade from D6 to D7 the vocabulary terms assigned to features were
|
|
|
// copied to the field_data_taxonomyextra table rather than to the correct
|
|
@@ -381,90 +382,30 @@ function tripal_feature_update_7200() {
|
|
|
|
|
|
// set the default feature property vocabulary
|
|
|
try {
|
|
|
- $cv_id = db_query("SELECT cv_id FROM chado.cv WHERE name = 'feature_property'")->fetchField();
|
|
|
- $cdi = db_select('tripal_cv_defaults', 't')
|
|
|
- ->fields('t', array('cv_default_id'))
|
|
|
- ->condition('table_name', 'featureprop')
|
|
|
- ->condition('field_name', 'type_id')
|
|
|
- ->execute()
|
|
|
- ->fetchField();
|
|
|
- if (!$cdi) {
|
|
|
- db_insert('tripal_cv_defaults')
|
|
|
- ->fields(array(
|
|
|
- 'table_name' => 'featureprop',
|
|
|
- 'field_name' => 'type_id',
|
|
|
- 'cv_id' => $cv_id
|
|
|
- ))
|
|
|
- ->execute();
|
|
|
- }
|
|
|
- }
|
|
|
- catch (\PDOException $e) {
|
|
|
- $error = $e->getMessage();
|
|
|
- throw new DrupalUpdateException('Failed to set feature_property vocabulary as default: '. $error);
|
|
|
- }
|
|
|
-
|
|
|
- // add the feature_relationshp CV
|
|
|
- try {
|
|
|
- $cv_id = db_query("SELECT cv_id FROM chado.cv WHERE name = 'feature_relationship'")->fetchField();
|
|
|
- if (!$cv_id) {
|
|
|
- // add the vocabulary
|
|
|
- $cv_id = db_insert('chado.cv')
|
|
|
- ->fields(array(
|
|
|
- 'name' => 'feature_relationship',
|
|
|
- 'definition' => 'Contains types of relationships between features.'
|
|
|
- ))
|
|
|
- ->execute();
|
|
|
- }
|
|
|
- // use the new featureprop CV we just added
|
|
|
- $cdi = db_select('tripal_cv_defaults', 't')
|
|
|
- ->fields('t', array('cv_default_id'))
|
|
|
- ->condition('table_name', 'feature_relationship')
|
|
|
- ->condition('field_name', 'type_id')
|
|
|
- ->execute()
|
|
|
- ->fetchField();
|
|
|
- if (!$cdi) {
|
|
|
- db_insert('tripal_cv_defaults')
|
|
|
- ->fields(array(
|
|
|
- 'table_name' => 'feature_relationship',
|
|
|
- 'field_name' => 'type_id',
|
|
|
- 'cv_id' => $cv_id
|
|
|
- ))
|
|
|
- ->execute();
|
|
|
- }
|
|
|
- }
|
|
|
- catch (\PDOException $e) {
|
|
|
- $error = $e->getMessage();
|
|
|
- throw new DrupalUpdateException('Failed to add feature_relationship vocabulary: '. $error);
|
|
|
+ tripal_insert_cv(
|
|
|
+ 'feature_relationship',
|
|
|
+ 'Contains types of relationships between features.'
|
|
|
+ );
|
|
|
+
|
|
|
+ // the feature_property CV already exists... it comes with chado, but we need to
|
|
|
+ // add it just in case it doesn't get added before the feature module is installed
|
|
|
+ tripal_insert_cv(
|
|
|
+ 'feature_property',
|
|
|
+ 'Stores properties about features'
|
|
|
+ );
|
|
|
+
|
|
|
+ // the feature type vocabulary should be the sequence ontology, and even though
|
|
|
+ // this ontology should get loaded we will create it here just so that we can
|
|
|
+ // set the default vocabulary for the feature.type_id field
|
|
|
+ tripal_insert_cv(
|
|
|
+ 'sequence',
|
|
|
+ 'The Sequence Ontology'
|
|
|
+ );
|
|
|
+ tripal_set_default_cv('feature', 'type_id', 'sequence');
|
|
|
+ tripal_set_default_cv('featureprop', 'type_id', 'feature_property');
|
|
|
+ tripal_set_default_cv('feature_relationship', 'type_id', 'feature_relationship');
|
|
|
}
|
|
|
|
|
|
- // set the feature_type as the 'sequence' ontology
|
|
|
- try {
|
|
|
- $cv_id = db_query("SELECT cv_id FROM chado.cv WHERE name = 'sequence'")->fetchField();
|
|
|
- if (!$cv_id) {
|
|
|
- // add the vocabulary
|
|
|
- $cv_id = db_insert('chado.cv')
|
|
|
- ->fields(array(
|
|
|
- 'name' => 'sequence',
|
|
|
- 'definition' => 'The Sequence Ontology.'
|
|
|
- ))
|
|
|
- ->execute();
|
|
|
- }
|
|
|
- $cdi = db_select('tripal_cv_defaults', 't')
|
|
|
- ->fields('t', array('cv_default_id'))
|
|
|
- ->condition('table_name', 'feature')
|
|
|
- ->condition('field_name', 'type_id')
|
|
|
- ->execute()
|
|
|
- ->fetchField();
|
|
|
- if (!$cdi) {
|
|
|
- db_insert('tripal_cv_defaults')
|
|
|
- ->fields(array(
|
|
|
- 'table_name' => 'feature',
|
|
|
- 'field_name' => 'type_id',
|
|
|
- 'cv_id' => $cv_id
|
|
|
- ))
|
|
|
- ->execute();
|
|
|
- }
|
|
|
- }
|
|
|
catch (\PDOException $e) {
|
|
|
$error = $e->getMessage();
|
|
|
throw new DrupalUpdateException('Failed to add sequence vocabulary which will be used for the sequence ontology: '. $error);
|