function tripal_chado_install
3.x tripal_chado.install | tripal_chado_install() |
File
- tripal_chado/
tripal_chado.install, line 3
Code
function tripal_chado_install() {
// // The foreign key specification doesn't really add one to the
// // Drupal schema, it is just used internally, but we want one.
// db_query('
// ALTER TABLE {tripal_custom_tables}
// ADD CONSTRAINT tripal_custom_tables_fk1
// FOREIGN KEY (mview_id) REFERENCES {tripal_mviews} (mview_id)
// ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED
// ');
if (chado_is_installed()) {
// For an upgraded site we need to move some vocabulary terms over
// to the new 'local' vocabulary:
chado_insert_db(array(
'name' => 'local',
'description' => variable_get('site_name', 'This site.'),
));
// Move the library properties out of the tripal database and into the
// local database.
$sql = "
UPDATE {dbxref}
SET db_id = (SELECT db_id FROM {db} WHERE name = 'local')
WHERE dbxref_id IN (
SELECT DISTINCT CVT.dbxref_id
FROM {cvterm} CVT
INNER JOIN {cv} CV ON CV.cv_id = CVT.cv_id
WHERE CV.name IN (
'library_property',
'library_type',
'project_property',
'nd_experiment_types',
'nd_geolocation_property',
'tripal_analysis'
)
)
";
chado_query($sql);
}
}