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:

schemas/vegbien.for_ERD.my.sql
184 184
(
185 185
  aggregateoccurrence_id int(11) NOT NULL AUTO_INCREMENT,
186 186
  taxonoccurrence_id int(11) NOT NULL,
187
  taxonbin_id int(11),
187
  taxonbinmethod_id int(11),
188 188
  cover double precision,
189 189
  basalarea double precision,
190 190
  biomass double precision,
......
196 196
  count int(11) NOT NULL,
197 197
  accessioncode character varying(255),
198 198
  CONSTRAINT aggregateoccurrence_pkey PRIMARY KEY (aggregateoccurrence_id ),
199
  CONSTRAINT aggregateoccurrence_taxonbin_id FOREIGN KEY (taxonbin_id)
200
      REFERENCES taxonbin (taxonbin_id) MATCH SIMPLE
199
  CONSTRAINT aggregateoccurrence_taxonbinmethod_id FOREIGN KEY (taxonbinmethod_id)
200
      REFERENCES taxonbinmethod (taxonbinmethod_id) MATCH SIMPLE
201 201
      ON UPDATE CASCADE ON DELETE CASCADE,
202 202
  CONSTRAINT aggregateoccurrence_taxonoccurrence_id FOREIGN KEY (taxonoccurrence_id)
203 203
      REFERENCES taxonoccurrence (taxonoccurrence_id) MATCH SIMPLE
204 204
      ON UPDATE CASCADE ON DELETE CASCADE,
205
  CONSTRAINT aggregateoccurrence_keys UNIQUE (taxonoccurrence_id , taxonbin_id )
205
  CONSTRAINT aggregateoccurrence_keys UNIQUE (taxonoccurrence_id , taxonbinmethod_id )
206 206
);
207 207

  
208 208
CREATE TABLE individualplant -- VegBank's stemcount table.
......
356 356
  CONSTRAINT sizeclass_pkey PRIMARY KEY (sizeclass_id )
357 357
);
358 358

  
359
CREATE TABLE taxonbin -- Defines a set of aggregate measurements. Used by aggregateoccurrence to define how measurements were aggregated.
359
CREATE TABLE taxonbinmethod -- Defines a set of aggregate measurements. Used by aggregateoccurrence to define how measurements were aggregated.
360 360
(
361
  taxonbin_id int(11) NOT NULL,
361
  taxonbinmethod_id int(11) NOT NULL,
362 362
  label character varying(255) NOT NULL DEFAULT '',
363 363
  stratum_id int(11),
364 364
  sizeclass_id int(11),
365 365
  coverindex_id int(11),
366 366
  accessioncode character varying(255),
367
  CONSTRAINT taxonbin_pkey PRIMARY KEY (taxonbin_id ),
368
  CONSTRAINT taxonbin_sizeclass_id FOREIGN KEY (sizeclass_id)
367
  CONSTRAINT taxonbinmethod_pkey PRIMARY KEY (taxonbinmethod_id ),
368
  CONSTRAINT taxonbinmethod_sizeclass_id FOREIGN KEY (sizeclass_id)
369 369
      REFERENCES sizeclass (sizeclass_id) MATCH SIMPLE
370 370
      ON UPDATE CASCADE ON DELETE CASCADE,
371
  CONSTRAINT taxonbin_keys UNIQUE (label , stratum_id , sizeclass_id , coverindex_id )
371
  CONSTRAINT taxonbinmethod_keys UNIQUE (label , stratum_id , sizeclass_id , coverindex_id )
372 372
);
schemas/vegbien.for_wiki.sql
45 45
(
46 46
  aggregateoccurrence_id serial NOT NULL,
47 47
  taxonoccurrence_id integer NOT NULL,
48
  taxonbin_id integer,
48
  taxonbinmethod_id integer,
49 49
  cover double precision,
50 50
  basalarea double precision,
51 51
  biomass double precision,
......
156 156
  accessioncode character varying(255),
157 157
);
158 158

  
159
CREATE TABLE taxonbin -- Defines a set of aggregate measurements. Used by aggregateoccurrence to define how measurements were aggregated.
159
CREATE TABLE taxonbinmethod -- Defines a set of aggregate measurements. Used by aggregateoccurrence to define how measurements were aggregated.
160 160
(
161
  taxonbin_id integer NOT NULL,
161
  taxonbinmethod_id integer NOT NULL,
162 162
  label character varying(255) NOT NULL DEFAULT ''::character varying,
163 163
  stratum_id integer,
164 164
  sizeclass_id integer,
schemas/vegbien_empty.sql
65 65
TRUNCATE stratummethod CASCADE;
66 66
TRUNCATE stratumtype CASCADE;
67 67
TRUNCATE taxonalt CASCADE;
68
TRUNCATE taxonbin CASCADE;
68
TRUNCATE taxonbinmethod CASCADE;
69 69
TRUNCATE taxondetermination CASCADE;
70 70
TRUNCATE taxonoccurrence CASCADE;
71 71
TRUNCATE telephone CASCADE;
schemas/vegbien.for_ERD.sql
184 184
(
185 185
  aggregateoccurrence_id serial NOT NULL,
186 186
  taxonoccurrence_id integer NOT NULL,
187
  taxonbin_id integer,
187
  taxonbinmethod_id integer,
188 188
  cover double precision,
189 189
  basalarea double precision,
190 190
  biomass double precision,
......
196 196
  count integer NOT NULL,
197 197
  accessioncode character varying(255),
198 198
  CONSTRAINT aggregateoccurrence_pkey PRIMARY KEY (aggregateoccurrence_id ),
199
  CONSTRAINT aggregateoccurrence_taxonbin_id FOREIGN KEY (taxonbin_id)
200
      REFERENCES taxonbin (taxonbin_id) MATCH SIMPLE
199
  CONSTRAINT aggregateoccurrence_taxonbinmethod_id FOREIGN KEY (taxonbinmethod_id)
200
      REFERENCES taxonbinmethod (taxonbinmethod_id) MATCH SIMPLE
201 201
      ON UPDATE CASCADE ON DELETE CASCADE,
202 202
  CONSTRAINT aggregateoccurrence_taxonoccurrence_id FOREIGN KEY (taxonoccurrence_id)
203 203
      REFERENCES taxonoccurrence (taxonoccurrence_id) MATCH SIMPLE
204 204
      ON UPDATE CASCADE ON DELETE CASCADE,
205
  CONSTRAINT aggregateoccurrence_keys UNIQUE (taxonoccurrence_id , taxonbin_id )
205
  CONSTRAINT aggregateoccurrence_keys UNIQUE (taxonoccurrence_id , taxonbinmethod_id )
206 206
);
207 207

  
208 208
CREATE TABLE individualplant -- VegBank's stemcount table.
......
356 356
  CONSTRAINT sizeclass_pkey PRIMARY KEY (sizeclass_id )
357 357
);
358 358

  
359
CREATE TABLE taxonbin -- Defines a set of aggregate measurements. Used by aggregateoccurrence to define how measurements were aggregated.
359
CREATE TABLE taxonbinmethod -- Defines a set of aggregate measurements. Used by aggregateoccurrence to define how measurements were aggregated.
360 360
(
361
  taxonbin_id integer NOT NULL,
361
  taxonbinmethod_id integer NOT NULL,
362 362
  label character varying(255) NOT NULL DEFAULT ''::character varying,
363 363
  stratum_id integer,
364 364
  sizeclass_id integer,
365 365
  coverindex_id integer,
366 366
  accessioncode character varying(255),
367
  CONSTRAINT taxonbin_pkey PRIMARY KEY (taxonbin_id ),
368
  CONSTRAINT taxonbin_sizeclass_id FOREIGN KEY (sizeclass_id)
367
  CONSTRAINT taxonbinmethod_pkey PRIMARY KEY (taxonbinmethod_id ),
368
  CONSTRAINT taxonbinmethod_sizeclass_id FOREIGN KEY (sizeclass_id)
369 369
      REFERENCES sizeclass (sizeclass_id) MATCH SIMPLE
370 370
      ON UPDATE CASCADE ON DELETE CASCADE,
371
  CONSTRAINT taxonbin_keys UNIQUE (label , stratum_id , sizeclass_id , coverindex_id )
371
  CONSTRAINT taxonbinmethod_keys UNIQUE (label , stratum_id , sizeclass_id , coverindex_id )
372 372
);
schemas/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