tripal_views_search.install 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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. 'status' => array(
  26. 'description' => 'Weather this search will be used: 0 = inactive, 1 = active.',
  27. 'type' => 'int',
  28. 'unsigned' => TRUE,
  29. 'not null' => TRUE,
  30. 'default' => '0',
  31. ),
  32. ),
  33. 'unique_keys' => array(
  34. 'tripal_search_id' => array('tripal_search_id'),
  35. ),
  36. 'primary key' => array('tripal_search_id'),
  37. );
  38. $schema['tripal_mviews_join'] = array(
  39. 'description' => 'which materialzed views and chado tables to join in a given search',
  40. 'fields' => array(
  41. 'tripal_search_id' => array(
  42. 'description' => 'tripal search id from tripal_views_search table',
  43. 'type' => 'serial',
  44. 'unsigned' => TRUE,
  45. 'not null'=> TRUE,
  46. ),
  47. 'view_column' => array(
  48. 'description' => 'materialized view name and column',
  49. 'type' => 'varchar',
  50. 'length' => '255',
  51. 'not null' => TRUE,
  52. 'default' => '',
  53. ),
  54. 'chado_column' => array(
  55. 'description' => 'which chado table and column is to be linked up to materialized view in this serach',
  56. 'type' => 'varchar',
  57. 'length' => '255',
  58. 'not null' => TRUE,
  59. 'default' => '',
  60. ),
  61. ),
  62. 'unique_keys' => array(
  63. 'tripal_search_id' => array('tripal_search_id'),
  64. ),
  65. 'primary key' => array('tripal_search_id'),
  66. );
  67. $schema['tripal_views_handlers'] = array(
  68. 'description' => 'in formation for views: column and views handler name',
  69. 'fields' => array(
  70. 'tripal_search_id' => array(
  71. 'description' => 'which search this is used by from tripal_views_search table',
  72. 'type' => 'serial',
  73. 'unsigned' => TRUE,
  74. 'not null'=> TRUE,
  75. ),
  76. 'column_name' => array(
  77. 'description' => '',
  78. 'type' => 'varchar',
  79. 'length' => '255',
  80. 'not null' => TRUE,
  81. 'default' => '',
  82. ),
  83. 'handler_name' => array(
  84. 'description' => 'name of the views handler to be used for this particular search',
  85. 'type' => 'varchar',
  86. 'length' => '255',
  87. 'not null' => TRUE,
  88. 'default' => '',
  89. ),
  90. ),
  91. );
  92. return $schema;
  93. }
  94. function tripal_views_search_install(){
  95. drupal_install_schema('tripal_views_search');
  96. }
  97. function tripal_views_search_uninstall(){
  98. drupal_uninstall_schema('tripal_views_search');
  99. }
  100. /*
  101. * NOTE: when updating schema for this module's tables
  102. * follow api of schema module, otherwise on uninstall
  103. * the tables will not be removed correctly
  104. *
  105. */