GMOD / Chado

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

db_relationship type_id should be foreign key pointing to cvterm not db table #117

Closed dreyes17 closed 1 year ago

dreyes17 commented 3 years ago

Hello,

Right now the creation of the db_relationship table is:

create table db_relationship ( db_relationship_id bigserial not null, type_id bigint not null, subject_id bigint not null, object_id bigint not null, primary key (db_relationship_id), foreign key (type_id) references db (db_id) on delete cascade INITIALLY DEFERRED, foreign key (subject_id) references db (db_id) on delete cascade INITIALLY DEFERRED, foreign key (object_id) references db (db_id) on delete cascade INITIALLY DEFERRED, constraint db_relationship_c1 unique (subject_id,object_id,type_id) );

but it make sense to change the type_id reference to be the same as in the sequence module:

create table db_relationship ( db_relationship_id bigserial not null, type_id bigint not null, subject_id bigint not null, object_id bigint not null, primary key (db_relationship_id), foreign key (type_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED, foreign key (subject_id) references db (db_id) on delete cascade INITIALLY DEFERRED, foreign key (object_id) references db (db_id) on delete cascade INITIALLY DEFERRED, constraint db_relationship_c1 unique (subject_id,object_id,type_id) );

Hope it can help :)

scottcain commented 3 years ago

Yes, I agree. I'll make a branch and a PR

laceysanderson commented 1 year ago

This has been fixed and is merged into the main branch 🎉 Thanks for the report @dreyes17