Project

General

Profile

« Previous | Next » 

Revision 363

Renamed vegbien tables according to Bob Peet's new VegBank-VegBIEN mapping

View differences:

vegbien.sql
2357 2357

  
2358 2358
CREATE TABLE stemcount (
2359 2359
    stemcount_id integer NOT NULL,
2360
    collectiveobs_id integer NOT NULL,
2360
    collectiveobservation_id integer NOT NULL,
2361 2361
    stemdiameter double precision,
2362 2362
    stemdiameteraccuracy double precision,
2363 2363
    stemheight double precision,
......
2392 2392

  
2393 2393

  
2394 2394
--
2395
-- Name: individual; Type: TABLE; Schema: public; Owner: bien; Tablespace: 
2395
-- Name: individualplant; Type: TABLE; Schema: public; Owner: bien; Tablespace: 
2396 2396
--
2397 2397

  
2398
CREATE TABLE individual (
2399
    individual_id integer NOT NULL,
2398
CREATE TABLE individualplant (
2399
    individualplant_id integer NOT NULL,
2400 2400
    stemcount_id integer NOT NULL,
2401 2401
    stemcode character varying(20),
2402 2402
    stemxposition double precision,
......
2406 2406
);
2407 2407

  
2408 2408

  
2409
ALTER TABLE public.individual OWNER TO bien;
2409
ALTER TABLE public.individualplant OWNER TO bien;
2410 2410

  
2411 2411
--
2412 2412
-- Name: stemlocation_stemlocation_id_seq; Type: SEQUENCE; Schema: public; Owner: bien
......
2426 2426
-- Name: stemlocation_stemlocation_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: bien
2427 2427
--
2428 2428

  
2429
ALTER SEQUENCE stemlocation_stemlocation_id_seq OWNED BY individual.individual_id;
2429
ALTER SEQUENCE stemlocation_stemlocation_id_seq OWNED BY individualplant.individualplant_id;
2430 2430

  
2431 2431

  
2432 2432
--
2433
-- Name: taxonbin; Type: TABLE; Schema: public; Owner: bien; Tablespace: 
2433
-- Name: stratum; Type: TABLE; Schema: public; Owner: bien; Tablespace: 
2434 2434
--
2435 2435

  
2436
CREATE TABLE taxonbin (
2437
    taxonbin_id integer NOT NULL,
2436
CREATE TABLE stratum (
2437
    stratum_id integer NOT NULL,
2438 2438
    plotevent_id integer NOT NULL,
2439 2439
    stratumtype_id integer NOT NULL,
2440 2440
    stratummethod_id integer,
......
2446 2446
);
2447 2447

  
2448 2448

  
2449
ALTER TABLE public.taxonbin OWNER TO bien;
2449
ALTER TABLE public.stratum OWNER TO bien;
2450 2450

  
2451 2451
--
2452 2452
-- Name: stratum_stratum_id_seq; Type: SEQUENCE; Schema: public; Owner: bien
......
2466 2466
-- Name: stratum_stratum_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: bien
2467 2467
--
2468 2468

  
2469
ALTER SEQUENCE stratum_stratum_id_seq OWNED BY taxonbin.taxonbin_id;
2469
ALTER SEQUENCE stratum_stratum_id_seq OWNED BY stratum.stratum_id;
2470 2470

  
2471 2471

  
2472 2472
--
......
2581 2581

  
2582 2582

  
2583 2583
--
2584
-- Name: collectiveobs; Type: TABLE; Schema: public; Owner: bien; Tablespace: 
2584
-- Name: collectiveobservation; Type: TABLE; Schema: public; Owner: bien; Tablespace: 
2585 2585
--
2586 2586

  
2587
CREATE TABLE collectiveobs (
2588
    collectiveobs_id integer NOT NULL,
2587
CREATE TABLE collectiveobservation (
2588
    collectiveobservation_id integer NOT NULL,
2589 2589
    taxonoccurrence_id integer NOT NULL,
2590
    taxonbin_id integer,
2590
    stratum_id integer,
2591 2591
    cover double precision,
2592 2592
    basalarea double precision,
2593 2593
    biomass double precision,
......
2599 2599
);
2600 2600

  
2601 2601

  
2602
ALTER TABLE public.collectiveobs OWNER TO bien;
2602
ALTER TABLE public.collectiveobservation OWNER TO bien;
2603 2603

  
2604 2604
--
2605 2605
-- Name: taxonimportance_taxonimportance_id_seq; Type: SEQUENCE; Schema: public; Owner: bien
......
2619 2619
-- Name: taxonimportance_taxonimportance_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: bien
2620 2620
--
2621 2621

  
2622
ALTER SEQUENCE taxonimportance_taxonimportance_id_seq OWNED BY collectiveobs.collectiveobs_id;
2622
ALTER SEQUENCE taxonimportance_taxonimportance_id_seq OWNED BY collectiveobservation.collectiveobservation_id;
2623 2623

  
2624 2624

  
2625 2625
--
......
2629 2629
CREATE TABLE taxondetermination (
2630 2630
    taxondetermination_id integer NOT NULL,
2631 2631
    taxonoccurrence_id integer NOT NULL,
2632
    individual_id integer,
2632
    individualplant_id integer,
2633 2633
    plantconcept_id integer NOT NULL,
2634 2634
    plantname_id integer,
2635 2635
    party_id integer NOT NULL,
......
3564 3564
--
3565 3565

  
3566 3566
CREATE VIEW view_csv_taxonimportance_pre AS
3567
    SELECT taxonoccurrence.plotevent_id, taxonoccurrence.authorplantname AS plant, CASE WHEN (collectiveobs.taxonbin_id IS NULL) THEN '-all-'::character varying ELSE (SELECT stratumtype.stratumname FROM stratumtype, taxonbin WHERE ((taxonbin.stratumtype_id = stratumtype.stratumtype_id) AND (taxonbin.taxonbin_id = collectiveobs.taxonbin_id))) END AS taxonbin, collectiveobs.cover, (SELECT min((coverindex.covercode)::text) AS min FROM coverindex WHERE (((coverindex.coverpercent = collectiveobs.cover) AND (coverindex.covermethod_id = plotevent.covermethod_id)) AND (plotevent.plotevent_id = taxonoccurrence.plotevent_id))) AS covercode_exact, (SELECT min((coverindex.covercode)::text) AS min FROM coverindex WHERE ((((coverindex.upperlimit >= collectiveobs.cover) AND (coverindex.lowerlimit <= collectiveobs.cover)) AND (coverindex.covermethod_id = plotevent.covermethod_id)) AND (plotevent.plotevent_id = taxonoccurrence.plotevent_id))) AS covercode_byrange, collectiveobs.basalarea, taxonoccurrence.accessioncode FROM taxonoccurrence, collectiveobs, view_notemb_observation plotevent WHERE ((taxonoccurrence.taxonoccurrence_id = collectiveobs.taxonoccurrence_id) AND (taxonoccurrence.plotevent_id = plotevent.plotevent_id));
3567
    SELECT taxonoccurrence.plotevent_id, taxonoccurrence.authorplantname AS plant, CASE WHEN (collectiveobservation.stratum_id IS NULL) THEN '-all-'::character varying ELSE (SELECT stratumtype.stratumname FROM stratumtype, stratum WHERE ((stratum.stratumtype_id = stratumtype.stratumtype_id) AND (stratum.stratum_id = collectiveobservation.stratum_id))) END AS stratum, collectiveobservation.cover, (SELECT min((coverindex.covercode)::text) AS min FROM coverindex WHERE (((coverindex.coverpercent = collectiveobservation.cover) AND (coverindex.covermethod_id = plotevent.covermethod_id)) AND (plotevent.plotevent_id = taxonoccurrence.plotevent_id))) AS covercode_exact, (SELECT min((coverindex.covercode)::text) AS min FROM coverindex WHERE ((((coverindex.upperlimit >= collectiveobservation.cover) AND (coverindex.lowerlimit <= collectiveobservation.cover)) AND (coverindex.covermethod_id = plotevent.covermethod_id)) AND (plotevent.plotevent_id = taxonoccurrence.plotevent_id))) AS covercode_byrange, collectiveobservation.basalarea, taxonoccurrence.accessioncode FROM taxonoccurrence, collectiveobservation, view_notemb_observation plotevent WHERE ((taxonoccurrence.taxonoccurrence_id = collectiveobservation.taxonoccurrence_id) AND (taxonoccurrence.plotevent_id = plotevent.plotevent_id));
3568 3568

  
3569 3569

  
3570 3570
ALTER TABLE public.view_csv_taxonimportance_pre OWNER TO bien;
......
3574 3574
--
3575 3575

  
3576 3576
CREATE VIEW view_csv_taxonimportance AS
3577
    SELECT view_csv_taxonimportance_pre.plotevent_id, view_csv_taxonimportance_pre.plant, view_csv_taxonimportance_pre.taxonbin, view_csv_taxonimportance_pre.cover, CASE WHEN (view_csv_taxonimportance_pre.covercode_exact IS NULL) THEN view_csv_taxonimportance_pre.covercode_byrange ELSE view_csv_taxonimportance_pre.covercode_exact END AS covercode, view_csv_taxonimportance_pre.basalarea, view_csv_taxonimportance_pre.accessioncode FROM view_csv_taxonimportance_pre;
3577
    SELECT view_csv_taxonimportance_pre.plotevent_id, view_csv_taxonimportance_pre.plant, view_csv_taxonimportance_pre.stratum, view_csv_taxonimportance_pre.cover, CASE WHEN (view_csv_taxonimportance_pre.covercode_exact IS NULL) THEN view_csv_taxonimportance_pre.covercode_byrange ELSE view_csv_taxonimportance_pre.covercode_exact END AS covercode, view_csv_taxonimportance_pre.basalarea, view_csv_taxonimportance_pre.accessioncode FROM view_csv_taxonimportance_pre;
3578 3578

  
3579 3579

  
3580 3580
ALTER TABLE public.view_csv_taxonimportance OWNER TO bien;
......
3704 3704
--
3705 3705

  
3706 3706
CREATE VIEW view_notemb_stemcount AS
3707
    SELECT stemcount.stemcount_id, stemcount.collectiveobs_id, stemcount.stemdiameter, stemcount.stemdiameteraccuracy, stemcount.stemheight, stemcount.stemheightaccuracy, stemcount.stemcount, stemcount.stemtaxonarea, stemcount.emb_stemcount FROM stemcount WHERE (stemcount.emb_stemcount < 6);
3707
    SELECT stemcount.stemcount_id, stemcount.collectiveobservation_id, stemcount.stemdiameter, stemcount.stemdiameteraccuracy, stemcount.stemheight, stemcount.stemheightaccuracy, stemcount.stemcount, stemcount.stemtaxonarea, stemcount.emb_stemcount FROM stemcount WHERE (stemcount.emb_stemcount < 6);
3708 3708

  
3709 3709

  
3710 3710
ALTER TABLE public.view_notemb_stemcount OWNER TO bien;
......
3714 3714
--
3715 3715

  
3716 3716
CREATE VIEW view_notemb_stemlocation AS
3717
    SELECT individual.individual_id, individual.stemcount_id, individual.stemcode, individual.stemxposition, individual.stemyposition, individual.stemhealth, individual.emb_stemlocation FROM individual WHERE (individual.emb_stemlocation < 6);
3717
    SELECT individualplant.individualplant_id, individualplant.stemcount_id, individualplant.stemcode, individualplant.stemxposition, individualplant.stemyposition, individualplant.stemhealth, individualplant.emb_stemlocation FROM individualplant WHERE (individualplant.emb_stemlocation < 6);
3718 3718

  
3719 3719

  
3720 3720
ALTER TABLE public.view_notemb_stemlocation OWNER TO bien;
......
3734 3734
--
3735 3735

  
3736 3736
CREATE VIEW view_notemb_taxonimportance AS
3737
    SELECT collectiveobs.collectiveobs_id, collectiveobs.taxonoccurrence_id, collectiveobs.taxonbin_id, collectiveobs.cover, collectiveobs.basalarea, collectiveobs.biomass, collectiveobs.inferencearea, collectiveobs.stratumbase, collectiveobs.stratumheight, collectiveobs.emb_taxonimportance, collectiveobs.covercode FROM collectiveobs WHERE (collectiveobs.emb_taxonimportance < 6);
3737
    SELECT collectiveobservation.collectiveobservation_id, collectiveobservation.taxonoccurrence_id, collectiveobservation.stratum_id, collectiveobservation.cover, collectiveobservation.basalarea, collectiveobservation.biomass, collectiveobservation.inferencearea, collectiveobservation.stratumbase, collectiveobservation.stratumheight, collectiveobservation.emb_taxonimportance, collectiveobservation.covercode FROM collectiveobservation WHERE (collectiveobservation.emb_taxonimportance < 6);
3738 3738

  
3739 3739

  
3740 3740
ALTER TABLE public.view_notemb_taxonimportance OWNER TO bien;
......
3744 3744
--
3745 3745

  
3746 3746
CREATE VIEW view_notemb_taxoninterpretation AS
3747
    SELECT taxondetermination.taxondetermination_id, taxondetermination.taxonoccurrence_id, taxondetermination.individual_id, taxondetermination.plantconcept_id, taxondetermination.plantname_id, taxondetermination.party_id, taxondetermination.role_id, taxondetermination.interpretationtype, taxondetermination.reference_id, taxondetermination.originalinterpretation, taxondetermination.currentinterpretation, taxondetermination.taxonfit, taxondetermination.taxonconfidence, taxondetermination.collector_id, taxondetermination.collectionnumber, taxondetermination.museum_id, taxondetermination.museumaccessionnumber, taxondetermination.grouptype, taxondetermination.notes, taxondetermination.notespublic, taxondetermination.notesmgt, taxondetermination.revisions, taxondetermination.interpretationdate, taxondetermination.collectiondate, taxondetermination.emb_taxoninterpretation, taxondetermination.accessioncode FROM taxondetermination WHERE (taxondetermination.emb_taxoninterpretation < 6);
3747
    SELECT taxondetermination.taxondetermination_id, taxondetermination.taxonoccurrence_id, taxondetermination.individualplant_id, taxondetermination.plantconcept_id, taxondetermination.plantname_id, taxondetermination.party_id, taxondetermination.role_id, taxondetermination.interpretationtype, taxondetermination.reference_id, taxondetermination.originalinterpretation, taxondetermination.currentinterpretation, taxondetermination.taxonfit, taxondetermination.taxonconfidence, taxondetermination.collector_id, taxondetermination.collectionnumber, taxondetermination.museum_id, taxondetermination.museumaccessionnumber, taxondetermination.grouptype, taxondetermination.notes, taxondetermination.notespublic, taxondetermination.notesmgt, taxondetermination.revisions, taxondetermination.interpretationdate, taxondetermination.collectiondate, taxondetermination.emb_taxoninterpretation, taxondetermination.accessioncode FROM taxondetermination WHERE (taxondetermination.emb_taxoninterpretation < 6);
3748 3748

  
3749 3749

  
3750 3750
ALTER TABLE public.view_notemb_taxoninterpretation OWNER TO bien;
......
3894 3894
--
3895 3895

  
3896 3896
CREATE VIEW view_taxoninterp_more AS
3897
    SELECT taxondetermination.taxondetermination_id, taxondetermination.taxonoccurrence_id, taxondetermination.individual_id, taxondetermination.plantconcept_id, taxondetermination.plantname_id, taxondetermination.party_id, taxondetermination.role_id, taxondetermination.interpretationtype, taxondetermination.reference_id, taxondetermination.originalinterpretation, taxondetermination.currentinterpretation, taxondetermination.taxonfit, taxondetermination.taxonconfidence, taxondetermination.collector_id, taxondetermination.collectionnumber, taxondetermination.museum_id, taxondetermination.museumaccessionnumber, taxondetermination.grouptype, taxondetermination.notes, taxondetermination.notespublic, taxondetermination.notesmgt, taxondetermination.revisions, taxondetermination.interpretationdate, taxondetermination.collectiondate, taxondetermination.emb_taxoninterpretation, taxondetermination.accessioncode, plantconcept.accessioncode AS pc_accessioncode, plantconcept.plantname AS pc_plantname, taxonoccurrence.plotevent_id FROM view_notemb_taxoninterpretation taxondetermination, taxonoccurrence, plantconcept WHERE ((taxonoccurrence.taxonoccurrence_id = taxondetermination.taxonoccurrence_id) AND (plantconcept.plantconcept_id = taxondetermination.plantconcept_id));
3897
    SELECT taxondetermination.taxondetermination_id, taxondetermination.taxonoccurrence_id, taxondetermination.individualplant_id, taxondetermination.plantconcept_id, taxondetermination.plantname_id, taxondetermination.party_id, taxondetermination.role_id, taxondetermination.interpretationtype, taxondetermination.reference_id, taxondetermination.originalinterpretation, taxondetermination.currentinterpretation, taxondetermination.taxonfit, taxondetermination.taxonconfidence, taxondetermination.collector_id, taxondetermination.collectionnumber, taxondetermination.museum_id, taxondetermination.museumaccessionnumber, taxondetermination.grouptype, taxondetermination.notes, taxondetermination.notespublic, taxondetermination.notesmgt, taxondetermination.revisions, taxondetermination.interpretationdate, taxondetermination.collectiondate, taxondetermination.emb_taxoninterpretation, taxondetermination.accessioncode, plantconcept.accessioncode AS pc_accessioncode, plantconcept.plantname AS pc_plantname, taxonoccurrence.plotevent_id FROM view_notemb_taxoninterpretation taxondetermination, taxonoccurrence, plantconcept WHERE ((taxonoccurrence.taxonoccurrence_id = taxondetermination.taxonoccurrence_id) AND (plantconcept.plantconcept_id = taxondetermination.plantconcept_id));
3898 3898

  
3899 3899

  
3900 3900
ALTER TABLE public.view_taxoninterp_more OWNER TO bien;
......
3904 3904
--
3905 3905

  
3906 3906
CREATE VIEW view_taxonobs_withmaxcover AS
3907
    SELECT taxonoccurrence.taxonoccurrence_id, taxonoccurrence.plotevent_id, taxonoccurrence.authorplantname, taxonoccurrence.reference_id, taxonoccurrence.taxoninferencearea, taxonoccurrence.emb_taxonobservation, taxonoccurrence.int_origplantconcept_id, taxonoccurrence.int_origplantscifull, taxonoccurrence.int_origplantscinamenoauth, taxonoccurrence.int_origplantcommon, taxonoccurrence.int_origplantcode, taxonoccurrence.int_currplantconcept_id, taxonoccurrence.int_currplantscifull, taxonoccurrence.int_currplantscinamenoauth, taxonoccurrence.int_currplantcommon, taxonoccurrence.int_currplantcode, taxonoccurrence.accessioncode, (SELECT max(collectiveobs.cover) AS max FROM collectiveobs WHERE (collectiveobs.taxonoccurrence_id = taxonoccurrence.taxonoccurrence_id)) AS maxcover FROM view_notemb_taxonobservation taxonoccurrence;
3907
    SELECT taxonoccurrence.taxonoccurrence_id, taxonoccurrence.plotevent_id, taxonoccurrence.authorplantname, taxonoccurrence.reference_id, taxonoccurrence.taxoninferencearea, taxonoccurrence.emb_taxonobservation, taxonoccurrence.int_origplantconcept_id, taxonoccurrence.int_origplantscifull, taxonoccurrence.int_origplantscinamenoauth, taxonoccurrence.int_origplantcommon, taxonoccurrence.int_origplantcode, taxonoccurrence.int_currplantconcept_id, taxonoccurrence.int_currplantscifull, taxonoccurrence.int_currplantscinamenoauth, taxonoccurrence.int_currplantcommon, taxonoccurrence.int_currplantcode, taxonoccurrence.accessioncode, (SELECT max(collectiveobservation.cover) AS max FROM collectiveobservation WHERE (collectiveobservation.taxonoccurrence_id = taxonoccurrence.taxonoccurrence_id)) AS maxcover FROM view_notemb_taxonobservation taxonoccurrence;
3908 3908

  
3909 3909

  
3910 3910
ALTER TABLE public.view_taxonobs_withmaxcover OWNER TO bien;
......
4325 4325

  
4326 4326

  
4327 4327
--
4328
-- Name: individual_id; Type: DEFAULT; Schema: public; Owner: bien
4328
-- Name: individualplant_id; Type: DEFAULT; Schema: public; Owner: bien
4329 4329
--
4330 4330

  
4331
ALTER TABLE individual ALTER COLUMN individual_id SET DEFAULT nextval('stemlocation_stemlocation_id_seq'::regclass);
4331
ALTER TABLE individualplant ALTER COLUMN individualplant_id SET DEFAULT nextval('stemlocation_stemlocation_id_seq'::regclass);
4332 4332

  
4333 4333

  
4334 4334
--
4335
-- Name: taxonbin_id; Type: DEFAULT; Schema: public; Owner: bien
4335
-- Name: stratum_id; Type: DEFAULT; Schema: public; Owner: bien
4336 4336
--
4337 4337

  
4338
ALTER TABLE taxonbin ALTER COLUMN taxonbin_id SET DEFAULT nextval('stratum_stratum_id_seq'::regclass);
4338
ALTER TABLE stratum ALTER COLUMN stratum_id SET DEFAULT nextval('stratum_stratum_id_seq'::regclass);
4339 4339

  
4340 4340

  
4341 4341
--
......
4360 4360

  
4361 4361

  
4362 4362
--
4363
-- Name: collectiveobs_id; Type: DEFAULT; Schema: public; Owner: bien
4363
-- Name: collectiveobservation_id; Type: DEFAULT; Schema: public; Owner: bien
4364 4364
--
4365 4365

  
4366
ALTER TABLE collectiveobs ALTER COLUMN collectiveobs_id SET DEFAULT nextval('taxonimportance_taxonimportance_id_seq'::regclass);
4366
ALTER TABLE collectiveobservation ALTER COLUMN collectiveobservation_id SET DEFAULT nextval('taxonimportance_taxonimportance_id_seq'::regclass);
4367 4367

  
4368 4368

  
4369 4369
--
......
4930 4930
-- Name: stemlocation_pkey; Type: CONSTRAINT; Schema: public; Owner: bien; Tablespace: 
4931 4931
--
4932 4932

  
4933
ALTER TABLE ONLY individual
4934
    ADD CONSTRAINT stemlocation_pkey PRIMARY KEY (individual_id);
4933
ALTER TABLE ONLY individualplant
4934
    ADD CONSTRAINT stemlocation_pkey PRIMARY KEY (individualplant_id);
4935 4935

  
4936 4936

  
4937 4937
--
4938 4938
-- Name: stratum_pkey; Type: CONSTRAINT; Schema: public; Owner: bien; Tablespace: 
4939 4939
--
4940 4940

  
4941
ALTER TABLE ONLY taxonbin
4942
    ADD CONSTRAINT stratum_pkey PRIMARY KEY (taxonbin_id);
4941
ALTER TABLE ONLY stratum
4942
    ADD CONSTRAINT stratum_pkey PRIMARY KEY (stratum_id);
4943 4943

  
4944 4944

  
4945 4945
--
......
4970 4970
-- Name: taxonimportance_pkey; Type: CONSTRAINT; Schema: public; Owner: bien; Tablespace: 
4971 4971
--
4972 4972

  
4973
ALTER TABLE ONLY collectiveobs
4974
    ADD CONSTRAINT taxonimportance_pkey PRIMARY KEY (collectiveobs_id);
4973
ALTER TABLE ONLY collectiveobservation
4974
    ADD CONSTRAINT taxonimportance_pkey PRIMARY KEY (collectiveobservation_id);
4975 4975

  
4976 4976

  
4977 4977
--
......
5443 5443
-- Name: emb_stemlocation_idx; Type: INDEX; Schema: public; Owner: bien; Tablespace: 
5444 5444
--
5445 5445

  
5446
CREATE INDEX emb_stemlocation_idx ON individual USING btree (emb_stemlocation);
5446
CREATE INDEX emb_stemlocation_idx ON individualplant USING btree (emb_stemlocation);
5447 5447

  
5448 5448

  
5449 5449
--
......
5457 5457
-- Name: emb_taxonimportance_idx; Type: INDEX; Schema: public; Owner: bien; Tablespace: 
5458 5458
--
5459 5459

  
5460
CREATE INDEX emb_taxonimportance_idx ON collectiveobs USING btree (emb_taxonimportance);
5460
CREATE INDEX emb_taxonimportance_idx ON collectiveobservation USING btree (emb_taxonimportance);
5461 5461

  
5462 5462

  
5463 5463
--
......
5989 5989
-- Name: stemcount_taxonimportance_id_x; Type: INDEX; Schema: public; Owner: bien; Tablespace: 
5990 5990
--
5991 5991

  
5992
CREATE INDEX stemcount_taxonimportance_id_x ON stemcount USING btree (collectiveobs_id);
5992
CREATE INDEX stemcount_taxonimportance_id_x ON stemcount USING btree (collectiveobservation_id);
5993 5993

  
5994 5994

  
5995 5995
--
5996 5996
-- Name: stemlocation_stemcount_id_x; Type: INDEX; Schema: public; Owner: bien; Tablespace: 
5997 5997
--
5998 5998

  
5999
CREATE INDEX stemlocation_stemcount_id_x ON individual USING btree (stemcount_id);
5999
CREATE INDEX stemlocation_stemcount_id_x ON individualplant USING btree (stemcount_id);
6000 6000

  
6001 6001

  
6002 6002
--
6003 6003
-- Name: stratum_observation_id_x; Type: INDEX; Schema: public; Owner: bien; Tablespace: 
6004 6004
--
6005 6005

  
6006
CREATE INDEX stratum_observation_id_x ON taxonbin USING btree (plotevent_id);
6006
CREATE INDEX stratum_observation_id_x ON stratum USING btree (plotevent_id);
6007 6007

  
6008 6008

  
6009 6009
--
6010 6010
-- Name: stratum_stratummethod_id_x; Type: INDEX; Schema: public; Owner: bien; Tablespace: 
6011 6011
--
6012 6012

  
6013
CREATE INDEX stratum_stratummethod_id_x ON taxonbin USING btree (stratummethod_id);
6013
CREATE INDEX stratum_stratummethod_id_x ON stratum USING btree (stratummethod_id);
6014 6014

  
6015 6015

  
6016 6016
--
6017 6017
-- Name: stratum_stratumtype_id_x; Type: INDEX; Schema: public; Owner: bien; Tablespace: 
6018 6018
--
6019 6019

  
6020
CREATE INDEX stratum_stratumtype_id_x ON taxonbin USING btree (stratumtype_id);
6020
CREATE INDEX stratum_stratumtype_id_x ON stratum USING btree (stratumtype_id);
6021 6021

  
6022 6022

  
6023 6023
--
......
6059 6059
-- Name: taxonimportance_stratum_id_x; Type: INDEX; Schema: public; Owner: bien; Tablespace: 
6060 6060
--
6061 6061

  
6062
CREATE INDEX taxonimportance_stratum_id_x ON collectiveobs USING btree (taxonbin_id);
6062
CREATE INDEX taxonimportance_stratum_id_x ON collectiveobservation USING btree (stratum_id);
6063 6063

  
6064 6064

  
6065 6065
--
6066 6066
-- Name: taxonimportance_taxonobservation_id_x; Type: INDEX; Schema: public; Owner: bien; Tablespace: 
6067 6067
--
6068 6068

  
6069
CREATE INDEX taxonimportance_taxonobservation_id_x ON collectiveobs USING btree (taxonoccurrence_id);
6069
CREATE INDEX taxonimportance_taxonobservation_id_x ON collectiveobservation USING btree (taxonoccurrence_id);
6070 6070

  
6071 6071

  
6072 6072
--
......
6129 6129
-- Name: taxoninterpretation_stemlocation_id_x; Type: INDEX; Schema: public; Owner: bien; Tablespace: 
6130 6130
--
6131 6131

  
6132
CREATE INDEX taxoninterpretation_stemlocation_id_x ON taxondetermination USING btree (individual_id);
6132
CREATE INDEX taxoninterpretation_stemlocation_id_x ON taxondetermination USING btree (individualplant_id);
6133 6133

  
6134 6134

  
6135 6135
--
......
6618 6618
--
6619 6619

  
6620 6620
ALTER TABLE ONLY stemcount
6621
    ADD CONSTRAINT r1stemcount_taxonimportance_id FOREIGN KEY (collectiveobs_id) REFERENCES collectiveobs(collectiveobs_id);
6621
    ADD CONSTRAINT r1stemcount_taxonimportance_id FOREIGN KEY (collectiveobservation_id) REFERENCES collectiveobservation(collectiveobservation_id);
6622 6622

  
6623 6623

  
6624 6624
--
6625 6625
-- Name: r1stemlocation_stemcount_id; Type: FK CONSTRAINT; Schema: public; Owner: bien
6626 6626
--
6627 6627

  
6628
ALTER TABLE ONLY individual
6628
ALTER TABLE ONLY individualplant
6629 6629
    ADD CONSTRAINT r1stemlocation_stemcount_id FOREIGN KEY (stemcount_id) REFERENCES stemcount(stemcount_id);
6630 6630

  
6631 6631

  
......
6633 6633
-- Name: r1stratum_observation_id; Type: FK CONSTRAINT; Schema: public; Owner: bien
6634 6634
--
6635 6635

  
6636
ALTER TABLE ONLY taxonbin
6636
ALTER TABLE ONLY stratum
6637 6637
    ADD CONSTRAINT r1stratum_observation_id FOREIGN KEY (plotevent_id) REFERENCES plotevent(plotevent_id);
6638 6638

  
6639 6639

  
......
6665 6665
-- Name: r1taxonimportance_taxonobservation_id; Type: FK CONSTRAINT; Schema: public; Owner: bien
6666 6666
--
6667 6667

  
6668
ALTER TABLE ONLY collectiveobs
6668
ALTER TABLE ONLY collectiveobservation
6669 6669
    ADD CONSTRAINT r1taxonimportance_taxonobservation_id FOREIGN KEY (taxonoccurrence_id) REFERENCES taxonoccurrence(taxonoccurrence_id);
6670 6670

  
6671 6671

  
......
6969 6969
-- Name: r2stratum_stratumtype_id; Type: FK CONSTRAINT; Schema: public; Owner: bien
6970 6970
--
6971 6971

  
6972
ALTER TABLE ONLY taxonbin
6972
ALTER TABLE ONLY stratum
6973 6973
    ADD CONSTRAINT r2stratum_stratumtype_id FOREIGN KEY (stratumtype_id) REFERENCES stratumtype(stratumtype_id);
6974 6974

  
6975 6975

  
......
6985 6985
-- Name: r2taxonimportance_stratum_id; Type: FK CONSTRAINT; Schema: public; Owner: bien
6986 6986
--
6987 6987

  
6988
ALTER TABLE ONLY collectiveobs
6989
    ADD CONSTRAINT r2taxonimportance_stratum_id FOREIGN KEY (taxonbin_id) REFERENCES taxonbin(taxonbin_id);
6988
ALTER TABLE ONLY collectiveobservation
6989
    ADD CONSTRAINT r2taxonimportance_stratum_id FOREIGN KEY (stratum_id) REFERENCES stratum(stratum_id);
6990 6990

  
6991 6991

  
6992 6992
--
......
6994 6994
--
6995 6995

  
6996 6996
ALTER TABLE ONLY taxondetermination
6997
    ADD CONSTRAINT r2taxoninterpretation_stemlocation_id FOREIGN KEY (individual_id) REFERENCES individual(individual_id);
6997
    ADD CONSTRAINT r2taxoninterpretation_stemlocation_id FOREIGN KEY (individualplant_id) REFERENCES individualplant(individualplant_id);
6998 6998

  
6999 6999

  
7000 7000
--
......
7113 7113
-- Name: r3stratum_stratummethod_id; Type: FK CONSTRAINT; Schema: public; Owner: bien
7114 7114
--
7115 7115

  
7116
ALTER TABLE ONLY taxonbin
7116
ALTER TABLE ONLY stratum
7117 7117
    ADD CONSTRAINT r3stratum_stratummethod_id FOREIGN KEY (stratummethod_id) REFERENCES stratummethod(stratummethod_id);
7118 7118

  
7119 7119

  
......
7251 7251
-- PostgreSQL database dump complete
7252 7252
--
7253 7253

  
7254
CREATE TABLE taxonbin (
7255
    taxonbin_id integer NOT NULL,
7256
    label character varying(255) NOT NULL,
7257
    stratum_id integer,
7258
    sizeclass_id integer,
7259
    coverindex_id integer
7260
);

Also available in: Unified diff