tripal_eimage.install 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. /**
  3. * @file
  4. * This file contains all the functions which describe and implement drupal database tables
  5. * needed by this module.
  6. *
  7. * The eimage manamgenet module allows you to sync data in a chado/Tripal instance with
  8. * multiple eimages as well as manage and create such eimages
  9. */
  10. /**
  11. * Implementation of hook_install().
  12. */
  13. function tripal_eimage_install() {
  14. drupal_install_schema('tripal_eimage');
  15. }
  16. /**
  17. * Implementation of hook_uninstall().
  18. */
  19. function tripal_eimage_uninstall() {
  20. drupal_uninstall_schema('tripal_eimage');
  21. }
  22. /**
  23. * Implementation of hook_schema().
  24. */
  25. function tripal_eimage_schema() {
  26. $schema['chado_eimage'] = array(
  27. 'fields' => array(
  28. 'nid' => array(
  29. 'type' => 'int',
  30. 'unsigned' => TRUE,
  31. 'not null' => TRUE,
  32. ),
  33. 'vid' => array(
  34. 'type' => 'int',
  35. 'not null' => TRUE,
  36. ),
  37. 'eimage_id' => array(
  38. 'type' => 'int',
  39. 'unsigned' => TRUE,
  40. 'not null' => TRUE,
  41. ),
  42. ),
  43. 'primary key' => array('nid', 'vid', 'eimage_id'),
  44. );
  45. return $schema;
  46. }
  47. /**
  48. * Implementation of hook_requirements().
  49. *
  50. */
  51. function tripal_eimage_requirements($phase) {
  52. $requirements = array();
  53. if ($phase == 'install') {
  54. // make sure chado is installed
  55. if (!tripal_core_is_chado_installed()) {
  56. $requirements ['tripal_eimage'] = array(
  57. 'title' => "tripal_eimage",
  58. 'value' => "ERROR: Chado most be installed before this module can be enabled",
  59. 'severity' => REQUIREMENT_ERROR,
  60. );
  61. }
  62. }
  63. return $requirements;
  64. }