Skip to content

Commit

Permalink
Merge pull request #7 from GMOD/move_ddl2modules
Browse files Browse the repository at this point in the history
Created db module and moved db/dbxref tables to it
  • Loading branch information
scottcain committed May 28, 2015
2 parents 49be6a4 + 87d2604 commit 8cdad86
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 48 deletions.
File renamed without changes.
49 changes: 1 addition & 48 deletions chado/modules/general/general.sql
Original file line number Diff line number Diff line change
Expand Up @@ -19,51 +19,4 @@ create table tableinfo (
constraint tableinfo_c1 unique (name)
);

COMMENT ON TABLE tableinfo IS NULL;

-- ================================================
-- TABLE: db
-- ================================================

create table db (
db_id bigserial not null,
primary key (db_id),
name varchar(255) not null,
-- contact_id int,
-- foreign key (contact_id) references contact (contact_id) on delete cascade INITIALLY DEFERRED,
description varchar(255) null,
urlprefix varchar(255) null,
url varchar(255) null,
constraint db_c1 unique (name)
);

COMMENT ON TABLE db IS 'A database authority. Typical databases in
bioinformatics are FlyBase, GO, UniProt, NCBI, MGI, etc. The authority
is generally known by this shortened form, which is unique within the
bioinformatics and biomedical realm. To Do - add support for URIs,
URNs (e.g. LSIDs). We can do this by treating the URL as a URI -
however, some applications may expect this to be resolvable - to be
decided.';

-- ================================================
-- TABLE: dbxref
-- ================================================

create table dbxref (
dbxref_id bigserial not null,
primary key (dbxref_id),
db_id bigint not null,
foreign key (db_id) references db (db_id) on delete cascade INITIALLY DEFERRED,
accession varchar(255) not null,
version varchar(255) not null default '',
description text,
constraint dbxref_c1 unique (db_id,accession,version)
);
create index dbxref_idx1 on dbxref (db_id);
create index dbxref_idx2 on dbxref (accession);
create index dbxref_idx3 on dbxref (version);

COMMENT ON TABLE dbxref IS 'A unique, global, public, stable identifier. Not necessarily an external reference - can reference data items inside the particular chado instance being used. Typically a row in a table can be uniquely identified with a primary identifier (called dbxref_id); a table may also have secondary identifiers (in a linking table <T>_dbxref). A dbxref is generally written as <DB>:<ACCESSION> or as <DB>:<ACCESSION>:<VERSION>.';

COMMENT ON COLUMN dbxref.accession IS 'The local part of the identifier. Guaranteed by the db authority to be unique for that db.';

COMMENT ON TABLE tableinfo IS NULL;

0 comments on commit 8cdad86

Please sign in to comment.