-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added migration script for nd_fact table.
- Loading branch information
Showing
1 changed file
with
14 additions
and
0 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
chado/migrations/V1.3.3.010__add_environmental_fact_table.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
-- Adds a new "nd_fact" table to store environmental data. | ||
CREATE TABLE nd_fact( | ||
nd_fact_id BIGSERIAL PRIMARY KEY NOT NULL, | ||
nd_geolocation_id BIGINT NOT NULL REFERENCES nd_geolocation (nd_geolocation_id) ON DELETE CASCADE INITIALLY DEFERRED, | ||
type_id BIGINT NOT NULL REFERENCES cvterm (cvterm_id) ON DELETE CASCADE INITIALLY DEFERRED, | ||
timecaptured TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
value TEXT NULL, | ||
CONSTRAINT nd_fact_c1 UNIQUE (nd_geolocation_id, type_id, timecaptured) | ||
); | ||
CREATE INDEX nd_fact_idx1 ON nd_fact (nd_geolocation_id); | ||
CREATE INDEX nd_fact_idx2 ON nd_fact (timecaptured); | ||
|
||
COMMENT ON TABLE nd_fact IS 'The fact table contains facts (temparture, weather condition,...) at a given time for a given geolocation.'; | ||
COMMENT ON COLUMN nd_fact.value IS 'The value can be NULL if the type_id is self-explicit. For instance, if the type_id term is "sunny day", there is no need for a value.'; |