Skip to content

Commit

Permalink
Updated production_structure.sql file.
Browse files Browse the repository at this point in the history
  • Loading branch information
gsrohde committed Sep 9, 2015
1 parent caab1d5 commit cd70f3d
Showing 1 changed file with 7 additions and 185 deletions.
192 changes: 7 additions & 185 deletions db/production_structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -846,21 +846,6 @@ CREATE SEQUENCE counties_id_seq
CACHE 1;
--
-- Name: counties; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE counties (
id bigint DEFAULT nextval('counties_id_seq'::regclass) NOT NULL,
name character varying(255),
created_at timestamp(6) without time zone DEFAULT utc_now(),
updated_at timestamp(6) without time zone DEFAULT utc_now(),
state character varying(255),
state_fips integer,
county_fips integer
);
--
-- Name: covariates_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
Expand Down Expand Up @@ -1069,8 +1054,7 @@ CREATE TABLE ensembles (
created_at timestamp(6) without time zone DEFAULT utc_now(),
updated_at timestamp(6) without time zone DEFAULT utc_now(),
runtype character varying(255) NOT NULL,
workflow_id bigint,
CONSTRAINT valid_ensemble_runtype CHECK (((runtype)::text = ANY ((ARRAY['ensemble'::character varying, 'sensitivity analysis'::character varying, 'MCMC'::character varying, 'pda.emulator'::character varying])::text[])))
workflow_id bigint
);
Expand Down Expand Up @@ -1119,14 +1103,14 @@ CREATE SEQUENCE formats_id_seq
CREATE TABLE formats (
id bigint DEFAULT nextval('formats_id_seq'::regclass) NOT NULL,
mime_type character varying(255),
dataformat text DEFAULT ''::text NOT NULL,
notes text DEFAULT ''::text NOT NULL,
created_at timestamp(6) without time zone DEFAULT utc_now(),
updated_at timestamp(6) without time zone DEFAULT utc_now(),
name character varying(255) NOT NULL,
header character varying(255) DEFAULT ''::character varying NOT NULL,
skip character varying(255) DEFAULT ''::character varying NOT NULL,
mimetype_id bigint,
CONSTRAINT normalized_format_name CHECK (is_whitespace_normalized((name)::text))
);
Expand Down Expand Up @@ -1226,38 +1210,6 @@ CREATE SEQUENCE inputs_runs_id_seq
ALTER SEQUENCE inputs_runs_id_seq OWNED BY inputs_runs.id;
--
-- Name: inputs_variables; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE inputs_variables (
input_id bigint NOT NULL,
variable_id bigint NOT NULL,
created_at timestamp(6) without time zone DEFAULT utc_now(),
updated_at timestamp(6) without time zone DEFAULT utc_now(),
id bigint NOT NULL
);
--
-- Name: inputs_variables_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE inputs_variables_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: inputs_variables_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE inputs_variables_id_seq OWNED BY inputs_variables.id;
--
-- Name: likelihoods_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
Expand Down Expand Up @@ -1300,20 +1252,6 @@ CREATE SEQUENCE location_yields_id_seq
CACHE 1;
--
-- Name: location_yields; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE location_yields (
id bigint DEFAULT nextval('location_yields_id_seq'::regclass) NOT NULL,
yield numeric(20,15),
species character varying(255),
created_at timestamp(6) without time zone DEFAULT utc_now(),
updated_at timestamp(6) without time zone DEFAULT utc_now(),
county_id bigint
);
--
-- Name: machines_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
Expand Down Expand Up @@ -1946,9 +1884,7 @@ CREATE TABLE runs (
updated_at timestamp(6) without time zone DEFAULT utc_now(),
started_at timestamp(6) without time zone,
finished_at timestamp(6) without time zone,
ensemble_id bigint NOT NULL,
start_date character varying(255),
end_date character varying(255)
ensemble_id bigint NOT NULL
);
Expand Down Expand Up @@ -2680,6 +2616,10 @@ CREATE TABLE yields (
checked integer DEFAULT 0 NOT NULL,
access_level level_of_access,
method_id bigint,
entity_id bigint,
date_year integer,
date_month integer,
date_day integer,
CONSTRAINT valid_yield_checked_value CHECK (((checked >= (-1)) AND (checked <= 1)))
);
Expand Down Expand Up @@ -3011,13 +2951,6 @@ ALTER TABLE ONLY current_posteriors ALTER COLUMN id SET DEFAULT nextval('current
ALTER TABLE ONLY inputs_runs ALTER COLUMN id SET DEFAULT nextval('inputs_runs_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY inputs_variables ALTER COLUMN id SET DEFAULT nextval('inputs_variables_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
Expand Down Expand Up @@ -3082,14 +3015,6 @@ ALTER TABLE ONLY citations
ADD CONSTRAINT citations_pkey PRIMARY KEY (id);
--
-- Name: counties_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY counties
ADD CONSTRAINT counties_pkey PRIMARY KEY (id);
--
-- Name: covariates_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
Expand Down Expand Up @@ -3170,14 +3095,6 @@ ALTER TABLE ONLY likelihoods
ADD CONSTRAINT likelihoods_pkey PRIMARY KEY (id);
--
-- Name: location_yields_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY location_yields
ADD CONSTRAINT location_yields_pkey PRIMARY KEY (id);
--
-- Name: machines_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
Expand Down Expand Up @@ -3346,14 +3263,6 @@ ALTER TABLE ONLY inputs_runs
ADD CONSTRAINT unique_input_run_pair UNIQUE (input_id, run_id);
--
-- Name: unique_input_variable_pairs; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY inputs_variables
ADD CONSTRAINT unique_input_variable_pairs UNIQUE (input_id, variable_id);
--
-- Name: unique_name_per_model; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
Expand Down Expand Up @@ -3519,13 +3428,6 @@ CREATE INDEX index_dbfiles_on_updated_user_id ON dbfiles USING btree (updated_us
CREATE INDEX index_entities_on_parent_id ON entities USING btree (parent_id);
--
-- Name: index_formats_on_mime_type; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_formats_on_mime_type ON formats USING btree (mime_type);
--
-- Name: index_formats_variables_on_format_id_and_variable_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
Expand Down Expand Up @@ -3568,13 +3470,6 @@ CREATE INDEX index_inputs_on_user_id ON inputs USING btree (user_id);
CREATE UNIQUE INDEX index_inputs_runs_on_input_id_and_run_id ON inputs_runs USING btree (input_id, run_id);
--
-- Name: index_inputs_variables_on_input_id_and_variable_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE UNIQUE INDEX index_inputs_variables_on_input_id_and_variable_id ON inputs_variables USING btree (input_id, variable_id);
--
-- Name: index_likelihoods_on_input_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
Expand All @@ -3596,34 +3491,6 @@ CREATE INDEX index_likelihoods_on_run_id ON likelihoods USING btree (run_id);
CREATE INDEX index_likelihoods_on_variable_id ON likelihoods USING btree (variable_id);
--
-- Name: index_location_yields_on_county_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_location_yields_on_county_id ON location_yields USING btree (county_id);
--
-- Name: index_location_yields_on_location_and_species; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_location_yields_on_location_and_species ON location_yields USING btree (species);
--
-- Name: index_location_yields_on_species_and_county_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_location_yields_on_species_and_county_id ON location_yields USING btree (species, county_id);
--
-- Name: index_location_yields_on_yield; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_location_yields_on_yield ON location_yields USING btree (yield);
--
-- Name: index_machines_on_hostname; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
Expand Down Expand Up @@ -4036,13 +3903,6 @@ CREATE TRIGGER update_citations_timestamp BEFORE UPDATE ON citations FOR EACH RO
CREATE TRIGGER update_citations_treatments_timestamp BEFORE UPDATE ON citations_treatments FOR EACH ROW EXECUTE PROCEDURE update_timestamp();
--
-- Name: update_counties_timestamp; Type: TRIGGER; Schema: public; Owner: -
--
CREATE TRIGGER update_counties_timestamp BEFORE UPDATE ON counties FOR EACH ROW EXECUTE PROCEDURE update_timestamp();
--
-- Name: update_covariates_timestamp; Type: TRIGGER; Schema: public; Owner: -
--
Expand Down Expand Up @@ -4120,27 +3980,13 @@ CREATE TRIGGER update_inputs_runs_timestamp BEFORE UPDATE ON inputs_runs FOR EAC
CREATE TRIGGER update_inputs_timestamp BEFORE UPDATE ON inputs FOR EACH ROW EXECUTE PROCEDURE update_timestamp();
--
-- Name: update_inputs_variables_timestamp; Type: TRIGGER; Schema: public; Owner: -
--
CREATE TRIGGER update_inputs_variables_timestamp BEFORE UPDATE ON inputs_variables FOR EACH ROW EXECUTE PROCEDURE update_timestamp();
--
-- Name: update_likelihoods_timestamp; Type: TRIGGER; Schema: public; Owner: -
--
CREATE TRIGGER update_likelihoods_timestamp BEFORE UPDATE ON likelihoods FOR EACH ROW EXECUTE PROCEDURE update_timestamp();
--
-- Name: update_location_yields_timestamp; Type: TRIGGER; Schema: public; Owner: -
--
CREATE TRIGGER update_location_yields_timestamp BEFORE UPDATE ON location_yields FOR EACH ROW EXECUTE PROCEDURE update_timestamp();
--
-- Name: update_machines_timestamp; Type: TRIGGER; Schema: public; Owner: -
--
Expand Down Expand Up @@ -4523,22 +4369,6 @@ ALTER TABLE ONLY inputs
ADD CONSTRAINT fk_inputs_users_1 FOREIGN KEY (user_id) REFERENCES users(id);
--
-- Name: fk_inputs_variables_inputs_1; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY inputs_variables
ADD CONSTRAINT fk_inputs_variables_inputs_1 FOREIGN KEY (input_id) REFERENCES inputs(id) ON DELETE CASCADE;
--
-- Name: fk_inputs_variables_variables_1; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY inputs_variables
ADD CONSTRAINT fk_inputs_variables_variables_1 FOREIGN KEY (variable_id) REFERENCES variables(id) ON DELETE CASCADE;
--
-- Name: fk_likelihoods_inputs_1; Type: FK CONSTRAINT; Schema: public; Owner: -
--
Expand All @@ -4563,14 +4393,6 @@ ALTER TABLE ONLY likelihoods
ADD CONSTRAINT fk_likelihoods_variables_1 FOREIGN KEY (variable_id) REFERENCES variables(id);
--
-- Name: fk_location_yields_counties_1; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY location_yields
ADD CONSTRAINT fk_location_yields_counties_1 FOREIGN KEY (county_id) REFERENCES counties(id);
--
-- Name: fk_managements_citations_1; Type: FK CONSTRAINT; Schema: public; Owner: -
--
Expand Down

0 comments on commit cd70f3d

Please sign in to comment.