Project

General

Profile

« Previous | Next » 

Revision 584

vegbien.sql: Renamed taxonbin to taxonbinmethod to reflect that it does not contain actual organisms (those go in aggregateoccurrence), but rather defined a method of aggregating organisms

View differences:

vegbien.sql
78 78
CREATE TABLE aggregateoccurrence (
79 79
    aggregateoccurrence_id integer NOT NULL,
80 80
    taxonoccurrence_id integer NOT NULL,
81
    taxonbin_id integer,
81
    taxonbinmethod_id integer,
82 82
    cover double precision,
83 83
    basalarea double precision,
84 84
    biomass double precision,
......
2486 2486

  
2487 2487

  
2488 2488
--
2489
-- Name: taxonbin; Type: TABLE; Schema: public; Owner: -; Tablespace: 
2489
-- Name: taxonbinmethod; Type: TABLE; Schema: public; Owner: -; Tablespace: 
2490 2490
--
2491 2491

  
2492
CREATE TABLE taxonbin (
2493
    taxonbin_id integer NOT NULL,
2492
CREATE TABLE taxonbinmethod (
2493
    taxonbinmethod_id integer NOT NULL,
2494 2494
    label character varying(255) DEFAULT ''::character varying NOT NULL,
2495 2495
    stratum_id integer,
2496 2496
    sizeclass_id integer,
......
2500 2500

  
2501 2501

  
2502 2502
--
2503
-- Name: TABLE taxonbin; Type: COMMENT; Schema: public; Owner: -
2503
-- Name: TABLE taxonbinmethod; Type: COMMENT; Schema: public; Owner: -
2504 2504
--
2505 2505

  
2506
COMMENT ON TABLE taxonbin IS 'Defines a set of aggregate measurements. Used by aggregateoccurrence to define how measurements were aggregated.';
2506
COMMENT ON TABLE taxonbinmethod IS 'Defines a set of aggregate measurements. Used by aggregateoccurrence to define how measurements were aggregated.';
2507 2507

  
2508 2508

  
2509 2509
--
......
3774 3774
--
3775 3775

  
3776 3776
ALTER TABLE ONLY aggregateoccurrence
3777
    ADD CONSTRAINT aggregateoccurrence_keys UNIQUE (taxonoccurrence_id, taxonbin_id);
3777
    ADD CONSTRAINT aggregateoccurrence_keys UNIQUE (taxonoccurrence_id, taxonbinmethod_id);
3778 3778

  
3779 3779

  
3780 3780
--
......
4418 4418

  
4419 4419

  
4420 4420
--
4421
-- Name: taxonbin_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4421
-- Name: taxonbinmethod_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4422 4422
--
4423 4423

  
4424
ALTER TABLE ONLY taxonbin
4425
    ADD CONSTRAINT taxonbin_keys UNIQUE (label, stratum_id, sizeclass_id, coverindex_id);
4424
ALTER TABLE ONLY taxonbinmethod
4425
    ADD CONSTRAINT taxonbinmethod_keys UNIQUE (label, stratum_id, sizeclass_id, coverindex_id);
4426 4426

  
4427 4427

  
4428 4428
--
4429
-- Name: taxonbin_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4429
-- Name: taxonbinmethod_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4430 4430
--
4431 4431

  
4432
ALTER TABLE ONLY taxonbin
4433
    ADD CONSTRAINT taxonbin_pkey PRIMARY KEY (taxonbin_id);
4432
ALTER TABLE ONLY taxonbinmethod
4433
    ADD CONSTRAINT taxonbinmethod_pkey PRIMARY KEY (taxonbinmethod_id);
4434 4434

  
4435 4435

  
4436 4436
--
......
4608 4608

  
4609 4609

  
4610 4610
--
4611
-- Name: aggregateoccurrence_taxonbin_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4611
-- Name: aggregateoccurrence_taxonbinmethod_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4612 4612
--
4613 4613

  
4614
CREATE INDEX aggregateoccurrence_taxonbin_id_x ON aggregateoccurrence USING btree (taxonbin_id);
4614
CREATE INDEX aggregateoccurrence_taxonbinmethod_id_x ON aggregateoccurrence USING btree (taxonbinmethod_id);
4615 4615

  
4616 4616

  
4617 4617
--
......
5007 5007

  
5008 5008

  
5009 5009
--
5010
-- Name: fki_taxonbin_sizeclass_id; Type: INDEX; Schema: public; Owner: -; Tablespace: 
5010
-- Name: fki_taxonbinmethod_sizeclass_id; Type: INDEX; Schema: public; Owner: -; Tablespace: 
5011 5011
--
5012 5012

  
5013
CREATE INDEX fki_taxonbin_sizeclass_id ON taxonbin USING btree (sizeclass_id);
5013
CREATE INDEX fki_taxonbinmethod_sizeclass_id ON taxonbinmethod USING btree (sizeclass_id);
5014 5014

  
5015 5015

  
5016 5016
--
......
5800 5800

  
5801 5801

  
5802 5802
--
5803
-- Name: aggregateoccurrence_taxonbin_id; Type: FK CONSTRAINT; Schema: public; Owner: -
5803
-- Name: aggregateoccurrence_taxonbinmethod_id; Type: FK CONSTRAINT; Schema: public; Owner: -
5804 5804
--
5805 5805

  
5806 5806
ALTER TABLE ONLY aggregateoccurrence
5807
    ADD CONSTRAINT aggregateoccurrence_taxonbin_id FOREIGN KEY (taxonbin_id) REFERENCES taxonbin(taxonbin_id) ON UPDATE CASCADE ON DELETE CASCADE;
5807
    ADD CONSTRAINT aggregateoccurrence_taxonbinmethod_id FOREIGN KEY (taxonbinmethod_id) REFERENCES taxonbinmethod(taxonbinmethod_id) ON UPDATE CASCADE ON DELETE CASCADE;
5808 5808

  
5809 5809

  
5810 5810
--
......
6584 6584

  
6585 6585

  
6586 6586
--
6587
-- Name: taxonbin_sizeclass_id; Type: FK CONSTRAINT; Schema: public; Owner: -
6587
-- Name: taxonbinmethod_sizeclass_id; Type: FK CONSTRAINT; Schema: public; Owner: -
6588 6588
--
6589 6589

  
6590
ALTER TABLE ONLY taxonbin
6591
    ADD CONSTRAINT taxonbin_sizeclass_id FOREIGN KEY (sizeclass_id) REFERENCES sizeclass(sizeclass_id) ON UPDATE CASCADE ON DELETE CASCADE;
6590
ALTER TABLE ONLY taxonbinmethod
6591
    ADD CONSTRAINT taxonbinmethod_sizeclass_id FOREIGN KEY (sizeclass_id) REFERENCES sizeclass(sizeclass_id) ON UPDATE CASCADE ON DELETE CASCADE;
6592 6592

  
6593 6593

  
6594 6594
--

Also available in: Unified diff