GMOD / Chado

the GMOD database schema
http://gmod.org/wiki/Chado
Artistic License 2.0
38 stars 25 forks source link

Add a contact_dbxref table #122

Open Ferrisx4 opened 2 years ago

Ferrisx4 commented 2 years ago

The proposed contact_dbxref table would be used to link contacts from contact to dbxref for the purpose of storing values such as the contact's ORCID or Google Scholar ID, or any other external database identifier.

A possible implementation of this, following other dbxref tables as a template:

-- Table Definition
CREATE TABLE "chado"."contact_dbxref" (
    "contact_dbxref_id" int8 NOT NULL DEFAULT nextval('chado.contact_dbxref_contact_dbxref_id_seq'::regclass),
    "contact_id" int8 NOT NULL,
    "dbxref_id" int8 NOT NULL,
    "is_current" int2 NOT NULL,
    CONSTRAINT "contact_dbxref_dbxref_id_fkey" FOREIGN KEY ("dbxref_id") REFERENCES "chado"."dbxref"("dbxref_id") ON DELETE CASCADE,
    CONSTRAINT "contact_dbxref_contact_id_fkey" FOREIGN KEY ("contact_id") REFERENCES "chado"."contact"("contact_id") ON DELETE CASCADE,
    PRIMARY KEY ("contact_dbxref_id")
);

This table was used in a custom plugin on a Tripal site. By utilizing dbxrefs, an individual contact can have multiple entries and their accessions will automatically be available to generate links to their profiles: Screen Shot 2022-01-20 at 2 02 38 PM

scottcain commented 2 years ago

This feels like a fairly straight forward addition and would be a small change I believe

laceysanderson commented 2 years ago

I support this change :-) @Ferrisx4 would you like to make a PR for it?

Ferrisx4 commented 2 years ago

Sure thing @laceysanderson

Ferrisx4 commented 2 years ago

Hi all, a few questions as it is my first attempt at contributing to Chado -

  1. Would this change be for 1.4x?
  2. After reading the docs and looking at previous PRs for adding tables, I will be adding a file into the migrations/ directory in the 1.4 branch, correct? There's also chado/migrations. As for the name, would it be something like V1.4.???.010__add_contact_dbxref_table.sql?.
spficklin commented 2 years ago

Hey @Ferrisx4 so you have been confused by what I just described in issue #130 . I think it needs some clarification. But it's my understanding for now, that you would use something like V1.3.3.011_add_contact_dbxref_table.sql. Valentin used the _010 suffix in the version for his PR #108 . And you want to do a pull request to the 1.4 branch.

Ferrisx4 commented 2 years ago

Oh wow, what timing, I hadn't seen #130! Thanks!

spficklin commented 2 years ago

Oh, and it seems @laceysanderson just used the _011 suffix in PR #118 so you'll want to go with _012.