tripal_views_search.install 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <?php
  2. function tripal_views_search_schema(){
  3. $schema = array();
  4. $schema['tripal_views_search'] = array(
  5. 'description' => 'contains the searches, their materialized view id and base table name that was used.',
  6. 'fields' => array(
  7. 'tripal_search_id' => array(
  8. 'description' => 'the id of the search',
  9. 'type' => 'serial',
  10. 'unsigned' => TRUE,
  11. 'not null' => TRUE,
  12. ),
  13. 'mview_id' => array(
  14. 'description' => 'the materialized view used for this search',
  15. 'type' => 'int',
  16. 'unsigned' => TRUE,
  17. ),
  18. 'base_table_name' => array(
  19. 'description' => 'the base table name to be used when using this search',
  20. 'type' => 'varchar',
  21. 'length' => 255,
  22. 'not null' => TRUE,
  23. 'default' => '',
  24. ),
  25. ),
  26. 'unique_keys' => array(
  27. 'tripal_search_id' => array('tripal_search_id'),
  28. ),
  29. 'primary key' => array('tripal_search_id'),
  30. );
  31. $schema['tripal_mviews_join'] = array(
  32. 'description' => 'which materialzed views and chado tables to join in a given search',
  33. 'fields' => array(
  34. 'tripal_search_id' => array(
  35. 'description' => 'tripal search id from tripal_views_search table',
  36. 'type' => 'serial',
  37. 'unsigned' => TRUE,
  38. 'not null'=> TRUE,
  39. ),
  40. 'view_column' => array(
  41. 'description' => 'materialized view name and column',
  42. 'type' => 'varchar',
  43. 'length' => '255',
  44. 'not null' => TRUE,
  45. 'default' => '',
  46. ),
  47. 'chado_column' => array(
  48. 'description' => 'which chado table and column is to be linked up to materialized view in this serach',
  49. 'type' => 'varchar',
  50. 'length' => '255',
  51. 'not null' => TRUE,
  52. 'default' => '',
  53. ),
  54. ),
  55. 'unique_keys' => array(
  56. 'tripal_search_id' => array('tripal_search_id'),
  57. ),
  58. 'primary key' => array('tripal_search_id'),
  59. );
  60. $schema['tripal_views_handlers'] = array(
  61. 'description' => 'in formation for views: column and views handler name',
  62. 'fields' => array(
  63. 'tripal_search_id' => array(
  64. 'description' => 'which search this is used by from tripal_views_search table',
  65. 'type' => 'serial',
  66. 'unsigned' => TRUE,
  67. 'not null'=> TRUE,
  68. ),
  69. 'column_name' => array(
  70. 'description' => '',
  71. 'type' => 'varchar',
  72. 'length' => '255',
  73. 'not null' => TRUE,
  74. 'default' => '',
  75. ),
  76. 'handler_name' => array(
  77. 'description' => 'name of the views handler to be used for this particular search',
  78. 'type' => 'varchar',
  79. 'length' => '255',
  80. 'not null' => TRUE,
  81. 'default' => '',
  82. ),
  83. ),
  84. );
  85. return $schema;
  86. }
  87. function tripal_views_search_install(){
  88. drupal_install_schema('tripal_views_search');
  89. }
  90. function tripal_views_search_uninstall(){
  91. drupal_uninstall_schema('tripal_views_search');
  92. }
  93. /*
  94. * NOTE: when updating schema for this module's tables
  95. * follow api of schema module, otherwise on uninstall
  96. * the tables will not be removed correctly
  97. *
  98. */