tripal_pub.install 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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 project manamgenet module allows you to sync data in a chado/Tripal instance with
  10. * multiple project/mysql instances as well as manage and create such project instances
  11. */
  12. /**
  13. * Implementation of hook_install()
  14. */
  15. function tripal_pub_install() {
  16. drupal_install_schema('tripal_pub');
  17. $dbxref = array('accession' => 'abstract', 'db_id'=>array('name'=>'tripal'));
  18. $success = tripal_core_chado_insert('dbxref',$dbxref);
  19. if ($success) {
  20. tripal_core_chado_insert('cvterm',array('name'=>'abstract','cv_id'=>array('name'=>'tripal'), 'db
  21. xref_id'=>$dbxref));
  22. }
  23. }
  24. /**
  25. * Implementation of hook_uninstall()
  26. */
  27. function tripal_pub_uninstall() {
  28. //Remove tables
  29. drupal_uninstall_schema('tripal_pub');
  30. }
  31. /**
  32. * Implementation of hook_schema()
  33. */
  34. function tripal_pub_schema() {
  35. //specification for 'tripal_pub_instances'
  36. $schema['chado_pub'] = array(
  37. 'fields' => array(
  38. //a int field that cannot be null and acts as a unique identifier for all nid's
  39. 'nid' => array(
  40. 'type' => 'int',
  41. 'unsigned' => TRUE,
  42. 'not null' => TRUE,
  43. ),
  44. //a int field that cannot be null and is vid
  45. 'vid' => array(
  46. 'type' => 'int',
  47. 'not null' => TRUE,
  48. ),
  49. //a intfield, not null and project_id is the unique_id of the project in chado
  50. 'pub_id' => array(
  51. 'type' => 'int',
  52. 'unsigned' => TRUE,
  53. 'not null' => TRUE,
  54. ),
  55. //a intfield, not null and project_id is the unique_id of the project in chado
  56. 'pubmed_id' => array(
  57. 'type' => 'int',
  58. 'unsigned' => TRUE,
  59. 'not null' => FALSE,
  60. ),
  61. 'author' => array(
  62. 'type' => 'text',
  63. 'size' => 'normal',
  64. 'not null' => TRUE,
  65. 'default' => '',
  66. 'description' => 'The Author Name.',
  67. ),
  68. ),
  69. //end of shema
  70. 'primary key' => array('nid'),
  71. );
  72. return $schema;
  73. }