function tripal_core_install_chado
2.x tripal_core.chado_install.inc | tripal_core_install_chado($action) |
1.x chado_install.inc | tripal_core_install_chado($action) |
Install Chado Schema
Related topics
2 string references to 'tripal_core_install_chado'
- tripal_core_chado_load_form_submit in tripal_core/
includes/ chado_install.inc - Submit Load Chado Schema 1.11 Form
- tripal_core_job_describe_args in tripal_core/
tripal_core.module - Implements hook_job_describe_args(). Describes the arguements for the tripal_update_mview job to allow for greater readability in the jobs details pages.
File
- tripal_core/
includes/ chado_install.inc, line 80 - Functions to install chado schema through Drupal
Code
function tripal_core_install_chado($action) {
$vsql = "INSERT INTO {chadoprop} (type_id, value) VALUES " .
"((SELECT cvterm_id " .
"FROM {cvterm} CVT " .
" INNER JOIN {cv} CV on CVT.cv_id = CV.cv_id " .
"WHERE CV.name = 'chado_properties' AND CVT.name = 'version'), " .
"'%s') ";
if ($action == 'Install Chado v1.2') {
$schema_file = drupal_get_path('module', 'tripal_core') . '/chado_schema/default_schema-1.2.sql';
$init_file = drupal_get_path('module', 'tripal_core') . '/chado_schema/initialize-1.2.sql';
if (tripal_core_reset_chado_schema()) {
$success = tripal_core_install_sql($schema_file);
if ($success) {
print "Install of Chado v1.2 (Step 1 of 2) Successful!\n";
}
else {
print "Installation (Step 1 of 2) Problems! Please check output above for errors.\n";
exit;
}
$success = tripal_core_install_sql($init_file);
if ($success) {
print "Install of Chado v1.2 (Step 2 of 2) Successful.\nInstallation Complete\n";
}
else {
print "Installation (Step 2 of 2) Problems! Please check output above for errors.\n";
exit;
}
chado_query($vsql, '1.2'); # set the version
}
else {
print "ERROR: cannot install chado. Please check database permissions\n";
exit;
}
}
elseif ($action == 'Upgrade Chado v1.11 to v1.2') {
$schema_file = drupal_get_path('module', 'tripal_core') . '/chado_schema/default_schema-1.11-1.2-diff.sql';
$init_file = drupal_get_path('module', 'tripal_core') . '/chado_schema/upgrade-1.11-1.2.sql';
$success = tripal_core_install_sql($schema_file);
if ($success) {
print "Upgrade from v1.11 to v1.2 (Step 1 of 2) Successful!\n";
}
else {
print "Upgrade (Step 1 of 2) problems! Please check output above for errors.\n";
exit;
}
$success = tripal_core_install_sql($init_file);
if ($success) {
print "Upgrade from v1.11 to v1.2 (Step 2 of 2) Successful.\nUpgrade Complete!\n";
}
else {
print "Upgrade (Step 2 of 2) problems! Please check output above for errors.\n";
exit;
}
chado_query($vsql, '1.2'); # set the version
}
elseif ($action == 'Install Chado v1.11') {
$schema_file = drupal_get_path('module', 'tripal_core') . '/chado_schema/default_schema-1.11.sql';
$init_file = drupal_get_path('module', 'tripal_core') . '/chado_schema/initialize-1.11.sql';
if (tripal_core_reset_chado_schema()) {
$success = tripal_core_install_sql($schema_file);
if ($success) {
print "Install of Chado v1.11 (Step 1 of 2) Successful!\n";
}
else {
print "Installation (Step 1 of 2) Problems! Please check output above for errors.\n";
exit;
}
$success = tripal_core_install_sql($init_file);
if ($success) {
print "Install of Chado v1.11 (Step 2 of 2) Successful.\nInstallation Complete!\n";
}
else {
print "Installation (Step 2 of 2) Problems! Please check output above for errors.\n";
exit;
}
}
else {
print "ERROR: cannot install chado. Please check database permissions\n";
exit;
}
}
}