diff --git a/chado/migrations/V1.3.3.012_add_contact_dbxref_table.sql b/chado/migrations/V1.3.3.012_add_contact_dbxref_table.sql new file mode 100644 index 00000000..0b94bc84 --- /dev/null +++ b/chado/migrations/V1.3.3.012_add_contact_dbxref_table.sql @@ -0,0 +1,15 @@ +CREATE TABLE contact_dbxref ( + contact_dbxref_id BIGSERIAL NOT NULL, + contact_id BIGINT NOT NULL, + dbxref_id BIGINT NOT NULL, + is_current INT NOT NULL, + PRIMARY KEY (contact_dbxref_id), + FOREIGN KEY (dbxref_id) REFERENCES dbxref (dbxref_id) ON DELETE CASCADE INITIALLY DEFERRED, + CONSTRAINT contact_dbxref_contact_id_fkey FOREIGN KEY (contact_id) REFERENCES contact (contact_id) ON DELETE CASCADE INITIALLY DEFERRED, +); + +create index contact_dbxref_idx1 on contact_dbxref (contact_id); +create index contact_dbxref_idx2 on contact_dbxref (dbxref_id); + +COMMENT ON TABLE contact_dbxref IS 'A contact_dbxref is a dbxref associated with a contact. +A contact can have many dbxrefs associated with it, and a dbxref can be associated with many contacts.' \ No newline at end of file