tripal_gbrowse.install 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <?php
  2. // $Id$
  3. /**
  4. * @file
  5. * This file contains all the functions which describe and implement drupal database tables
  6. * needed by this module. This module was developed by Chad N.A. Krilow and Lacey-Anne Sanderson,
  7. * University of Saskatchewan.
  8. *
  9. * The GBrowse manamgenet module allows you to sync data in a chado/Tripal instance with
  10. * multiple GBrowse/mysql instances as well as manage and create such GBrowse instances
  11. */
  12. /**
  13. * Implementation of hook_install()
  14. */
  15. function tripal_gbrowse_install() {
  16. drupal_install_schema('tripal_gbrowse');
  17. }
  18. function tripal_gbrowse_update_2 (&$sandbox) {
  19. $ret = array();
  20. db_add_field($ret, 'tripal_gbrowse_instances', 'nid', array('type' => 'int','unsigned' => FALSE, 'not null' => TRUE));
  21. db_add_field($ret, 'tripal_gbrowse_instances', 'vid', array('type' => 'int','unsigned' => FALSE, 'not null' => TRUE));
  22. return $ret;
  23. }
  24. /**
  25. * Implementation of hook_uninstall()
  26. */
  27. function tripal_gbrowse_uninstall() {
  28. drupal_uninstall_schema('tripal_gbrowse');
  29. }
  30. /**
  31. * Implementation of hook_schema()
  32. */
  33. function tripal_gbrowse_schema() {
  34. //specification for 'tripal_gbrowse_instances'
  35. $schema['tripal_gbrowse_instances'] = array(
  36. 'fields' => array(
  37. //a int field that cannot be null and acts as a unique identifier for all nid's
  38. 'nid' => array(
  39. 'type' => 'int',
  40. 'unsigned' => FALSE,
  41. 'not null' => TRUE,
  42. ),
  43. //a int field that cannot be null and is vid
  44. 'vid' => array(
  45. 'type' => 'int',
  46. 'unsigned' => FALSE,
  47. 'not null' => TRUE,
  48. ),
  49. //a serial field that cannot be null and acts as a unique identifier for all gbrowse instances
  50. 'gbrowse_id' => array(
  51. 'type' => 'serial',
  52. 'unsigned' => TRUE,
  53. 'not null' => TRUE,
  54. ),
  55. //a varchar field that cannot be null and is the name of a gbrowse instance
  56. 'database_name' => array(
  57. 'type' => 'varchar',
  58. 'not null' => TRUE,
  59. ),
  60. //a varchar field, not null and is name of a mysql user that has insert and select permissions on the database
  61. 'database_user' => array(
  62. 'type' => 'varchar',
  63. 'not null' => TRUE,
  64. ),
  65. //user_password: a varchar field that is the password for the above user
  66. 'user_password' => array(
  67. 'type' => 'varchar',
  68. 'not null' => TRUE,
  69. ),
  70. //name: a varchar which is a human-readable name for the gbrowse instance
  71. 'gbrowse_name' => array(
  72. 'type' => 'varchar',
  73. 'not null' => TRUE,
  74. ),
  75. //link: a varchar which is the link to the gbrowse instance
  76. 'gbrowse_link' => array(
  77. 'type' => 'varchar',
  78. 'not null' => TRUE,
  79. ),
  80. //config_file: fully qualified location to the gbrowse configuration file
  81. 'config_file' => array(
  82. 'type' => 'varchar',
  83. 'not null' => TRUE,
  84. ),
  85. ),//end of shema
  86. 'primary key' => array('gbrowse_id'),
  87. );
  88. return $schema;
  89. }