Hello,
here is the table cvterm. The column dbxref_id couldn't be null nut the foreign key is set to on delete set null. I have checked other tables with dbxref_id and they can be null such as the table feature for example. But in this case I think that having a cvterm without knowing its provenance doesn't make sense. Do you agree? So for me it should be on delete cascade rather than making dbxref_id nullable.
create table cvterm (
cvterm_id bigserial not null,
primary key (cvterm_id),
cv_id bigint not null,
foreign key (cv_id) references cv (cv_id) on delete cascade INITIALLY DEFERRED,
name varchar(1024) not null,
definition text,
dbxref_id bigint not null,
foreign key (dbxref_id) references dbxref (dbxref_id) on delete set null INITIALLY DEFERRED,
is_obsolete int not null default 0,
is_relationshiptype int not null default 0,
constraint cvterm_c1 unique (name,cv_id,is_obsolete),
constraint cvterm_c2 unique (dbxref_id)
);
There are also some tables where you explicitly put null even if it is initialized to that value by default so I don't know if you are missing the not or not. For instance:
create table featuremap (
featuremap_id bigserial not null,
primary key (featuremap_id),
name varchar(255),
description text,
unittype_id bigint null,
foreign key (unittype_id) references cvterm (cvterm_id) on delete set null INITIALLY DEFERRED,
constraint featuremap_c1 unique (name)
);
Maybe you can give an overview to the nulls.
Thank you
Hello,
here is the table cvterm. The column dbxref_id couldn't be null nut the foreign key is set to on delete set null. I have checked other tables with dbxref_id and they can be null such as the table feature for example. But in this case I think that having a cvterm without knowing its provenance doesn't make sense. Do you agree? So for me it should be on delete cascade rather than making dbxref_id nullable.
create table cvterm (
cvterm_id bigserial not null,
primary key (cvterm_id),
cv_id bigint not null,
foreign key (cv_id) references cv (cv_id) on delete cascade INITIALLY DEFERRED,
name varchar(1024) not null,
definition text,
dbxref_id bigint not null,
foreign key (dbxref_id) references dbxref (dbxref_id) on delete set null INITIALLY DEFERRED,
is_obsolete int not null default 0,
is_relationshiptype int not null default 0,
constraint cvterm_c1 unique (name,cv_id,is_obsolete),
constraint cvterm_c2 unique (dbxref_id)
);
There are also some tables where you explicitly put null even if it is initialized to that value by default so I don't know if you are missing the not or not. For instance:
create table featuremap (
featuremap_id bigserial not null,
primary key (featuremap_id),
name varchar(255),
description text,
unittype_id bigint null,
foreign key (unittype_id) references cvterm (cvterm_id) on delete set null INITIALLY DEFERRED,
constraint featuremap_c1 unique (name)
);
Maybe you can give an overview to the nulls.
Thank you