Skip to content

Commit

Permalink
added more sql commands
Browse files Browse the repository at this point in the history
  • Loading branch information
Travis Harrison committed Oct 29, 2012
1 parent 655e99e commit fe3790b
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/MGRAST/Schema/mgrast_analysis_v3.sql
Expand Up @@ -13,6 +13,7 @@ BEGIN
END;
$$ language 'plpgsql';

DROP TABLE IF EXISTS job_info;
CREATE TABLE job_info (
updated_on timestamp NOT NULL DEFAULT LOCALTIMESTAMP,
version smallint NOT NULL,
Expand All @@ -24,6 +25,7 @@ CREATE UNIQUE INDEX job_info_loaded ON job_info (loaded);
CREATE UNIQUE INDEX job_info_rna ON job_info (rna_only);
CREATE TRIGGER job_info_update_timestamp BEFORE UPDATE ON job_info FOR EACH ROW EXECUTE PROCEDURE update_timestamp();

DROP TABLE IF EXISTS job_md5s;
CREATE TABLE job_md5s (
version smallint NOT NULL,
job integer NOT NULL,
Expand All @@ -45,6 +47,7 @@ CREATE UNIQUE INDEX job_md5s_key ON job_md5s (version, job, md5);
CREATE INDEX job_md5s_job_protein ON job_md5s (job, is_protein);
CREATE INDEX job_md5s_seek_length ON job_md5s (seek, length);

DROP TABLE IF EXISTS job_functions;
CREATE TABLE job_functions (
version smallint NOT NULL,
job integer NOT NULL,
Expand All @@ -62,6 +65,7 @@ CREATE TABLE job_functions (
#COPY job_functions (version,job,function,abundance,exp_avg,exp_stdv,len_avg,len_stdv,ident_avg,ident_stdv,md5s,source) FROM 'FILE' WITH NULL AS '';
CREATE UNIQUE INDEX job_functions_key ON job_functions (version, job, function, source);

DROP TABLE IF EXISTS job_organisms;
CREATE TABLE job_organisms (
version smallint NOT NULL,
job integer NOT NULL,
Expand All @@ -79,6 +83,7 @@ CREATE TABLE job_organisms (
#COPY job_organisms (version,job,organism,abundance,exp_avg,exp_stdv,len_avg,len_stdv,ident_avg,ident_stdv,md5s,source) FROM 'FILE' WITH NULL AS '';
CREATE UNIQUE INDEX job_organisms_key ON job_organisms (version, job, organism, source);

DROP TABLE IF EXISTS job_rep_organisms;
CREATE TABLE job_rep_organisms (
version smallint NOT NULL,
job integer NOT NULL,
Expand All @@ -95,6 +100,7 @@ CREATE TABLE job_rep_organisms (
);
CREATE UNIQUE INDEX job_rep_organisms_key ON job_rep_organisms (version, job, organism, source);

DROP TABLE IF EXISTS job_ontologies;
CREATE TABLE job_ontologies (
version smallint NOT NULL,
job integer NOT NULL,
Expand All @@ -112,6 +118,7 @@ CREATE TABLE job_ontologies (
#COPY job_ontologies (version,job,id,abundance,exp_avg,exp_stdv,len_avg,len_stdv,ident_avg,ident_stdv,md5s,source) FROM 'FILE' WITH NULL AS '';
CREATE UNIQUE INDEX job_ontologies_key ON job_ontologies (version, job, id, source);

DROP TABLE IF EXISTS job_lcas;
CREATE TABLE job_lcas (
version smallint NOT NULL,
job integer NOT NULL,
Expand All @@ -130,12 +137,14 @@ CREATE TABLE job_lcas (
CREATE UNIQUE INDEX job_lcas_key ON job_lcas (version, job, lca);
CREATE INDEX job_lcas_level ON job_lcas (level);

DROP TABLE IF EXISTS functions;
CREATE TABLE functions (
_id SERIAL PRIMARY KEY,
name text NOT NULL
);
CREATE INDEX functions_name ON functions (name);

DROP TABLE IF EXISTS organisms_ncbi;
CREATE TABLE organisms_ncbi (
_id SERIAL PRIMARY KEY,
name text NOT NULL,
Expand All @@ -153,6 +162,15 @@ CREATE TABLE organisms_ncbi (
CREATE INDEX organisms_ncbi_name ON organisms_ncbi (name);
CREATE INDEX organisms_ncbi_tax_id ON organisms_ncbi (ncbi_tax_id);

DROP TABLE IF EXISTS md5_organism_unique;
CREATE TABLE md5_organism_unique (
md5 char(32) NOT NULL,
organism integer NOT NULL,
source text
);
CREATE INDEX md5_organism_unique_key ON md5_organism_unique (md5, source);

DROP TABLE IF EXISTS ontologies;
CREATE TABLE ontologies (
_id SERIAL PRIMARY KEY,
level1 text,
Expand Down

0 comments on commit fe3790b

Please sign in to comment.