tripal_project.install

  1. 2.x tripal_project/tripal_project.install
  2. 3.x legacy/tripal_project/tripal_project.install
  3. 1.x tripal_project/tripal_project.install

This file contains all the functions which describe and implement drupal database tables needed by this module. This module was developed by Chad N.A. Krilow and Lacey-Anne Sanderson, University of Saskatchewan.

The project manamgenet module allows you to sync data in a chado/Tripal instance with multiple project/mysql instances as well as manage and create such project instances

File

tripal_project/tripal_project.install
View source
  1. <?php
  2. /**
  3. * @file
  4. * This file contains all the functions which describe and implement drupal database tables
  5. * needed by this module. This module was developed by Chad N.A. Krilow and Lacey-Anne Sanderson,
  6. * University of Saskatchewan.
  7. *
  8. * The project manamgenet module allows you to sync data in a chado/Tripal instance with
  9. * multiple project/mysql instances as well as manage and create such project instances
  10. */
  11. /**
  12. * Implementation of hook_install().
  13. */
  14. function tripal_project_install() {
  15. drupal_install_schema('tripal_project');
  16. tripal_project_add_cvterms();
  17. }
  18. /**
  19. * Implementation of hook_uninstall().
  20. */
  21. function tripal_project_uninstall() {
  22. drupal_uninstall_schema('tripal_project');
  23. }
  24. /**
  25. * Implementation of hook_schema().
  26. */
  27. function tripal_project_schema() {
  28. $schema['chado_project'] = array(
  29. 'fields' => array(
  30. 'nid' => array(
  31. 'type' => 'int',
  32. 'unsigned' => TRUE,
  33. 'not null' => TRUE,
  34. ),
  35. 'vid' => array(
  36. 'type' => 'int',
  37. 'not null' => TRUE,
  38. ),
  39. 'project_id' => array(
  40. 'type' => 'int',
  41. 'unsigned' => TRUE,
  42. 'not null' => TRUE,
  43. ),
  44. ),
  45. 'primary key' => array('nid', 'vid', 'project_id'),
  46. );
  47. return $schema;
  48. }
  49. /**
  50. * Implementation of hook_requirements().
  51. *
  52. */
  53. function tripal_project_requirements($phase) {
  54. $requirements = array();
  55. if ($phase == 'install') {
  56. // make sure chado is installed
  57. if (!tripal_core_is_chado_installed()) {
  58. $requirements ['tripal_project'] = array(
  59. 'title' => "tripal_project",
  60. 'value' => "ERROR: Chado most be installed before this module can be enabled",
  61. 'severity' => REQUIREMENT_ERROR,
  62. );
  63. }
  64. }
  65. return $requirements;
  66. }
  67. /*
  68. *
  69. */
  70. function tripal_project_add_cvterms() {
  71. // Insert cvterm 'library_description' into cvterm table of chado
  72. // database. This CV term is used to keep track of the library
  73. // description in the libraryprop table.
  74. tripal_cv_add_cvterm(array('name' => 'project_description', 'def' => 'Description of a project'),
  75. 'tripal', 0, 1, 'tripal');
  76. }
  77. /**
  78. * Update for Drupal 6.x, Tripal 1.0
  79. * This update
  80. * - adds the library types
  81. *
  82. * @ingroup tripal_library
  83. */
  84. function tripal_project_update_6000() {
  85. // add in the missing library typ cv terms
  86. tripal_project_add_cvterms();
  87. return $ret;
  88. }