tripal_stock.install 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. /**
  3. * Install the tripal stock module including it's content type
  4. * @file
  5. */
  6. /**
  7. * Implementation of hook_requirements().
  8. *
  9. */
  10. function tripal_stock_requirements($phase) {
  11. $requirements = array();
  12. if ($phase == 'install') {
  13. // make sure chado is installed
  14. if (!tripal_core_is_chado_installed()) {
  15. $requirements ['tripal_stock'] = array(
  16. 'title' => "tripal_stock",
  17. 'value' => "ERROR: Chado most be installed before this module can be enabled",
  18. 'severity' => REQUIREMENT_ERROR,
  19. );
  20. }
  21. }
  22. return $requirements;
  23. }
  24. /**
  25. * Implementation of hook_install().
  26. */
  27. function tripal_stock_install() {
  28. // create the module's data directory
  29. tripal_create_moddir('tripal_stock');
  30. }
  31. /**
  32. * Implementation of hook_uninstall().
  33. */
  34. function tripal_stock_uninstall() {
  35. }
  36. /**
  37. * Implementation of hook_schema().
  38. */
  39. function tripal_stock_schema() {
  40. $schema['chado_stock'] = array(
  41. 'fields' => array(
  42. 'vid' => array(
  43. 'type' => 'int',
  44. 'unsigned' => TRUE,
  45. 'not null' => TRUE,
  46. ),
  47. 'nid' => array(
  48. 'type' => 'int',
  49. 'unsigned' => TRUE,
  50. 'not null' => TRUE,
  51. ),
  52. 'stock_id' => array(
  53. 'type' => 'int',
  54. 'unsigned' => TRUE,
  55. 'not null' => TRUE,
  56. ),
  57. ),
  58. 'indexes' => array(
  59. 'stock_id' => array('stock_id'),
  60. 'nid' => array('nid'),
  61. ),
  62. 'unique' => array(
  63. 'stock_id' => array('stock_id'),
  64. ),
  65. 'primary key' => array('vid'),
  66. );
  67. return $schema;
  68. }