tripal_chado.chado_v1_1.inc 1.1 KB

1234567891011121314151617181920212223242526
  1. <?php
  2. /**
  3. * Create a legacy custom chado table (analysisfeatureprop) to store properties
  4. * of analysisfeature links.
  5. *
  6. */
  7. function tripal_chado_add_analysisfeatureprop_table() {
  8. // Create analysisfeatureprop table in chado. This is needed for Chado
  9. // version 1.11, the table exists in Chado 1.2.
  10. if (!db_table_exists('chado.analysisfeatureprop')) {
  11. $sql = "
  12. CREATE TABLE {analysisfeatureprop} (
  13. analysisfeatureprop_id SERIAL PRIMARY KEY,
  14. analysisfeature_id INTEGER NOT NULL,
  15. type_id INTEGER NOT NULL,
  16. value TEXT,
  17. rank INTEGER NOT NULL,
  18. CONSTRAINT analysisfeature_id_type_id_rank UNIQUE (analysisfeature_id, type_id, rank),
  19. CONSTRAINT analysisfeatureprop_analysisfeature_id_fkey FOREIGN KEY (analysisfeature_id) REFERENCES {analysisfeature}(analysisfeature_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
  20. CONSTRAINT analysisfeatureprop_type_id_fkey FOREIGN KEY (type_id) REFERENCES {cvterm}(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED
  21. )
  22. ";
  23. chado_query($sql);
  24. }
  25. }