tripal_pub.install 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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'), 'dbxref_id' => $dbxref));
  20. }
  21. }
  22. /**
  23. * Implementation of hook_uninstall().
  24. */
  25. function tripal_pub_uninstall() {
  26. //Remove tables
  27. drupal_uninstall_schema('tripal_pub');
  28. }
  29. /**
  30. * Implementation of hook_schema().
  31. */
  32. function tripal_pub_schema() {
  33. //specification for 'tripal_pub_instances'
  34. $schema['chado_pub'] = array(
  35. 'fields' => array(
  36. //a int field that cannot be null and acts as a unique identifier for all nid's
  37. 'nid' => array(
  38. 'type' => 'int',
  39. 'unsigned' => TRUE,
  40. 'not null' => TRUE,
  41. ),
  42. //a int field that cannot be null and is vid
  43. 'vid' => array(
  44. 'type' => 'int',
  45. 'not null' => TRUE,
  46. ),
  47. //a intfield, not null and project_id is the unique_id of the project in chado
  48. 'pub_id' => array(
  49. 'type' => 'int',
  50. 'unsigned' => TRUE,
  51. 'not null' => TRUE,
  52. ),
  53. //a intfield, not null and project_id is the unique_id of the project in chado
  54. 'pubmed_id' => array(
  55. 'type' => 'int',
  56. 'unsigned' => TRUE,
  57. 'not null' => FALSE,
  58. ),
  59. 'author' => array(
  60. 'type' => 'text',
  61. 'size' => 'normal',
  62. 'not null' => TRUE,
  63. 'default' => '',
  64. 'description' => 'The Author Name.',
  65. ),
  66. ),
  67. //end of shema
  68. 'primary key' => array('nid'),
  69. );
  70. return $schema;
  71. }