tripal_fields_layout.install 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <?php
  2. /**
  3. * Implements hook_schema().
  4. */
  5. function tripal_fields_layout_schema() {
  6. $schema = array();
  7. $schema['tripal_panels'] = array(
  8. 'description' => 'The list of panels into which fields can be placed.',
  9. 'fields' => array(
  10. 'panel_id' => array(
  11. 'description' => 'The primary identifier for this table.',
  12. 'type' => 'serial',
  13. 'unsigned' => TRUE,
  14. 'not null' => TRUE,
  15. ),
  16. 'bundle_id' => array(
  17. 'description' => 'A bundle ID from the tripal_bundle table.',
  18. 'type' => 'int',
  19. 'not null' => TRUE,
  20. ),
  21. 'name' => array(
  22. 'description' => 'The computer readable name for the panel. This name must only have alphanumerical characters and underscores and must not begin with a number. ',
  23. 'type' => 'varchar',
  24. 'length' => 128,
  25. 'not null' => TRUE,
  26. 'default' => '',
  27. ),
  28. 'label' => array(
  29. 'description' => 'A human readable name for panel. This name will be shown to users in the sidebar menu.',
  30. 'type' => 'varchar',
  31. 'length' => 128,
  32. 'not null' => TRUE,
  33. 'default' => '',
  34. ),
  35. 'settings' => array(
  36. 'description' => 'Contains a serialized array tripal_fields_layoutof settings for the panel.',
  37. 'type' => 'text',
  38. 'not null' => FALSE,
  39. ),
  40. 'weight' => array(
  41. 'type' => 'int',
  42. 'not null' => FALSE,
  43. 'default' => 0
  44. ),
  45. ),
  46. 'indexes' => array(
  47. 'bundle_id' => array('bundle_id'),
  48. ),
  49. 'unique keys' => array(
  50. 'bundle_panel' => array('bundle_id', 'name'),
  51. ),
  52. 'foreign keys' => array(
  53. 'tripal_bundle' => array(
  54. 'table' => 'tripal_bundle',
  55. 'columns' => array(
  56. 'bundle_id' => 'id',
  57. ),
  58. ),
  59. ),
  60. 'primary key' => array('panel_id'),
  61. );
  62. $schema['tripal_panel_fields'] = array(
  63. 'description' => 'The list of panels into which fields can be placed.',
  64. 'fields' => array(
  65. 'panel_field_id' => array(
  66. 'description' => 'The primary identifier for this table.',
  67. 'type' => 'serial',
  68. 'unsigned' => TRUE,
  69. 'not null' => TRUE,
  70. ),
  71. 'panel_id' => array(
  72. 'description' => 'The primary identifier for this table.',
  73. 'type' => 'int',
  74. 'not null' => TRUE,
  75. ),
  76. 'field_id' => array(
  77. 'description' => 'A bundle ID from the tripal_bundle table.',
  78. 'type' => 'int',
  79. 'not null' => TRUE,
  80. ),
  81. ),
  82. 'indexes' => array(
  83. 'panel_id' => array('panel_id'),
  84. 'field_id' => array('field_id'),
  85. ),
  86. 'unique keys' => array(
  87. 'panel_field' => array('panel_id', 'field_id'),
  88. ),
  89. 'foreign keys' => array(
  90. 'tripal_panel' => array(
  91. 'table' => 'tripal_panel',
  92. 'columns' => array(
  93. 'panel_id' => 'panel_id',
  94. ),
  95. ),
  96. 'field_config' => array(
  97. 'table' => 'field_config',
  98. 'columns' => array(
  99. 'field_id' => 'id',
  100. ),
  101. ),
  102. ),
  103. 'primary key' => array('panel_field_id'),
  104. );
  105. return $schema;
  106. }
  107. /**
  108. *
  109. */
  110. function tripal_entities_add_tripal_bundle_panes_table(){
  111. $schema = array (
  112. 'table' => 'tripal_bundle_panes',
  113. 'fields' => array (
  114. 'pane_id' => array (
  115. 'type' => 'serial',
  116. 'not null' => TRUE
  117. ),
  118. 'bundle_id' => array(
  119. 'type' => 'int',
  120. 'not null' => TRUE
  121. ),
  122. 'name' => array (
  123. 'type' => 'varchar',
  124. 'length' => 128,
  125. 'not null' => TRUE
  126. ),
  127. 'weight' => array (
  128. 'type' => 'int',
  129. 'not null' => TRUE
  130. ),
  131. 'settings' => array(
  132. 'type' => 'text'
  133. ),
  134. ),
  135. 'primary key' => array (
  136. 0 => 'pane_id'
  137. ),
  138. 'foreign keys' => array (
  139. 'tripal_bundle' => array (
  140. 'table' => 'tripal_bundle',
  141. 'columns' => array (
  142. 'bundle_id' => 'bundle_id'
  143. ),
  144. ),
  145. ),
  146. 'unique keys' => array (
  147. 'tripal_bundle_panes_name' => array ('name'),
  148. ),
  149. 'indexes' => array(
  150. 'tripal_bundle_panes_bundle_id' => array('bundle_id'),
  151. ),
  152. );
  153. chado_create_custom_table('tripal_bundle_panes', $schema, TRUE);
  154. }