tripal_project.install 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. }
  17. /**
  18. * Implementation of hook_uninstall().
  19. */
  20. function tripal_project_uninstall() {
  21. drupal_uninstall_schema('tripal_project');
  22. }
  23. /**
  24. * Implementation of hook_schema().
  25. */
  26. function tripal_project_schema() {
  27. //specification for 'tripal_project_instances'
  28. $schema['chado_project'] = array(
  29. 'fields' => array(
  30. //a int field that cannot be null and acts as a unique identifier for all nid's
  31. 'nid' => array(
  32. 'type' => 'int',
  33. 'unsigned' => TRUE,
  34. 'not null' => TRUE,
  35. ),
  36. //a int field that cannot be null and is vid
  37. 'vid' => array(
  38. 'type' => 'int',
  39. 'not null' => TRUE,
  40. ),
  41. //a intfield, not null and project_id is the unique_id of the project in chado
  42. 'project_id' => array(
  43. 'type' => 'int',
  44. 'unsigned' => TRUE,
  45. 'not null' => TRUE,
  46. ),
  47. ),//end of shema
  48. 'primary key' => array('nid', 'vid', 'project_id'),
  49. );
  50. return $schema;
  51. }