tripal_entities.install 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. /**
  3. * Implementation of hook_schema().
  4. *
  5. */
  6. function tripal_entities_schema() {
  7. $schema['tripal_entity'] = array(
  8. 'description' => 'The base table for Tripal Vocabulary-based entities.',
  9. 'fields' => array(
  10. 'entity_id' => array(
  11. 'description' => 'The primary identifier for a vocabulary entity.',
  12. 'type' => 'serial',
  13. 'unsigned' => TRUE,
  14. 'not null' => TRUE,
  15. ),
  16. 'cvterm_id' => array(
  17. 'description' => 'The type of entity. This cvterm_id should match a record in the Chado cvterm table.',
  18. 'type' => 'varchar',
  19. 'length' => 32,
  20. 'not null' => TRUE,
  21. 'default' => '',
  22. ),
  23. 'tablename' => array(
  24. 'description' => 'The Chado table that contains the record that this entity is associated with.',
  25. 'type' => 'varchar',
  26. 'length' => 128,
  27. 'not null' => TRUE,
  28. 'default' => ''
  29. ),
  30. 'record_id' => array(
  31. 'description' => 'The unique numerical identifier for the record that this entity is associated with (e.g. feature_id, stock_id, library_id, etc.).',
  32. 'type' => 'int',
  33. 'not null' => TRUE,
  34. ),
  35. 'title' => array(
  36. 'description' => 'The title of this node, always treated as non-markup plain text.',
  37. 'type' => 'varchar',
  38. 'length' => 255,
  39. 'not null' => TRUE,
  40. 'default' => '',
  41. ),
  42. 'uid' => array(
  43. 'description' => 'The {users}.uid that owns this node; initially, this is the user that created it.',
  44. 'type' => 'int',
  45. 'not null' => TRUE,
  46. 'default' => 0,
  47. ),
  48. 'status' => array(
  49. 'description' => 'Boolean indicating whether the node is published (visible to non-administrators).',
  50. 'type' => 'int',
  51. 'not null' => TRUE,
  52. 'default' => 1,
  53. ),
  54. 'created' => array(
  55. 'description' => 'The Unix timestamp when the node was created.',
  56. 'type' => 'int',
  57. 'not null' => TRUE,
  58. 'default' => 0,
  59. ),
  60. 'changed' => array(
  61. 'description' => 'The Unix timestamp when the node was most recently saved.',
  62. 'type' => 'int',
  63. 'not null' => TRUE,
  64. 'default' => 0,
  65. ),
  66. ),
  67. 'indexes' => array(
  68. 'entity_changed' => array('changed'),
  69. 'entity_created' => array('created'),
  70. 'tablename' => array('tablename'),
  71. 'record_id' => array('record_id'),
  72. 'chado_record' => array('tablename', 'record_id'),
  73. 'cvterm_id' => array('cvterm_id'),
  74. 'uid' => array('uid'),
  75. ),
  76. 'unique keys' => array(
  77. 'record' => array('tablename', 'record_id'),
  78. ),
  79. 'primary key' => array('entity_id'),
  80. );
  81. return $schema;
  82. }