tripal_pub.install 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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_pub_install() {
  15. drupal_install_schema('tripal_pub');
  16. $dbxref = array('accession' => 'abstract', 'db_id' => array('name' => 'tripal'));
  17. $success = tripal_core_chado_insert('dbxref', $dbxref);
  18. if ($success) {
  19. tripal_core_chado_insert('cvterm', array('name' => 'abstract', 'cv_id' => array('name' => 'tripal'), 'db
  20. xref_id' => $dbxref));
  21. }
  22. }
  23. /**
  24. * Implementation of hook_uninstall()
  25. */
  26. function tripal_pub_uninstall() {
  27. //Remove tables
  28. drupal_uninstall_schema('tripal_pub');
  29. }
  30. /**
  31. * Implementation of hook_schema()
  32. */
  33. function tripal_pub_schema() {
  34. //specification for 'tripal_pub_instances'
  35. $schema['chado_pub'] = 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' => TRUE,
  41. 'not null' => TRUE,
  42. ),
  43. //a int field that cannot be null and is vid
  44. 'vid' => array(
  45. 'type' => 'int',
  46. 'not null' => TRUE,
  47. ),
  48. //a intfield, not null and project_id is the unique_id of the project in chado
  49. 'pub_id' => array(
  50. 'type' => 'int',
  51. 'unsigned' => TRUE,
  52. 'not null' => TRUE,
  53. ),
  54. //a intfield, not null and project_id is the unique_id of the project in chado
  55. 'pubmed_id' => array(
  56. 'type' => 'int',
  57. 'unsigned' => TRUE,
  58. 'not null' => FALSE,
  59. ),
  60. 'author' => array(
  61. 'type' => 'text',
  62. 'size' => 'normal',
  63. 'not null' => TRUE,
  64. 'default' => '',
  65. 'description' => 'The Author Name.',
  66. ),
  67. ),
  68. //end of shema
  69. 'primary key' => array('nid'),
  70. );
  71. return $schema;
  72. }