Project

General

Profile

« Previous | Next » 

Revision 6882

schemas/vegbien.sql: Reattached trait to taxonoccurrence instead of taxonlabel, because the TraitObservation traits data is actually associated with a particular occurrence (plant observation complete with location, date, etc.), rather than just a taxon

View differences:

vegbien.sql
4471 4471

  
4472 4472
CREATE TABLE trait (
4473 4473
    trait_id integer NOT NULL,
4474
    taxonlabel_id integer NOT NULL,
4474
    taxonoccurrence_id integer NOT NULL,
4475 4475
    name text NOT NULL,
4476 4476
    value text,
4477 4477
    units text
......
6589 6589
-- Name: trait_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: 
6590 6590
--
6591 6591

  
6592
CREATE UNIQUE INDEX trait_unique ON trait USING btree (taxonlabel_id, name, (COALESCE(value, '\N'::text)), (COALESCE(units, '\N'::text)));
6592
CREATE UNIQUE INDEX trait_unique ON trait USING btree (taxonoccurrence_id, name, (COALESCE(value, '\N'::text)), (COALESCE(units, '\N'::text)));
6593 6593

  
6594 6594

  
6595 6595
--
......
7705 7705

  
7706 7706

  
7707 7707
--
7708
-- Name: trait_taxonlabel_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
7708
-- Name: trait_taxonoccurrence_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
7709 7709
--
7710 7710

  
7711 7711
ALTER TABLE ONLY trait
7712
    ADD CONSTRAINT trait_taxonlabel_id_fkey FOREIGN KEY (taxonlabel_id) REFERENCES taxonlabel(taxonlabel_id) ON UPDATE CASCADE ON DELETE CASCADE;
7712
    ADD CONSTRAINT trait_taxonoccurrence_id_fkey FOREIGN KEY (taxonoccurrence_id) REFERENCES taxonoccurrence(taxonoccurrence_id) ON UPDATE CASCADE ON DELETE CASCADE;
7713 7713

  
7714 7714

  
7715 7715
--

Also available in: Unified diff