Project

General

Profile

« Previous | Next » 

Revision 1032

vegbien.sql: Added plotmethod. locationevent points to plotmethod instead of directly to method

View differences:

schemas/vegbien.my.sql
1080 1080
    sourceaccessioncode text,
1081 1081
    previous_id int(11),
1082 1082
    dateaccuracy text,
1083
    method_id int(11),
1083
    plotmethod_id int(11),
1084 1084
    methodnarrative text,
1085 1085
    taxonoccurrencearea double precision,
1086 1086
    coverdispersion text,
......
1775 1775

  
1776 1776

  
1777 1777
--
1778
-- Name: plotmethod; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1779
--
1780

  
1781
CREATE TABLE plotmethod (
1782
    plotmethod_id int(11) NOT NULL,
1783
    reference_id int(11),
1784
    name text NOT NULL,
1785
    description text,
1786
    accessioncode text,
1787
    method_id int(11),
1788
    shape text,
1789
    length text,
1790
    width text,
1791
    radius text,
1792
    area text
1793
);
1794

  
1795

  
1796
--
1797
-- Name: plotmethod_plotmethod_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1798
--
1799

  
1800

  
1801

  
1802

  
1803
--
1804
-- Name: plotmethod_plotmethod_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1805
--
1806

  
1807

  
1808

  
1809

  
1810
--
1778 1811
-- Name: project; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1779 1812
--
1780 1813

  
......
3244 3277

  
3245 3278

  
3246 3279
--
3280
-- Name: plotmethod_id; Type: DEFAULT; Schema: public; Owner: -
3281
--
3282

  
3283

  
3284

  
3285

  
3286
--
3247 3287
-- Name: project_id; Type: DEFAULT; Schema: public; Owner: -
3248 3288
--
3249 3289

  
......
3986 4026

  
3987 4027

  
3988 4028
--
4029
-- Name: plotmethod_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4030
--
4031

  
4032
ALTER TABLE plotmethod
4033
    ADD CONSTRAINT plotmethod_pkey PRIMARY KEY (plotmethod_id);
4034

  
4035

  
4036
--
3989 4037
-- Name: project_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3990 4038
--
3991 4039

  
......
4725 4773
-- Name: fki_locationevent_method_id; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4726 4774
--
4727 4775

  
4728
CREATE INDEX fki_locationevent_method_id ON locationevent  (method_id);
4776
CREATE INDEX fki_locationevent_method_id ON locationevent  (plotmethod_id);
4729 4777

  
4730 4778

  
4731 4779
--
......
4792 4840

  
4793 4841

  
4794 4842
--
4843
-- Name: fki_plotmethod_reference_id; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4844
--
4845

  
4846
CREATE INDEX fki_plotmethod_reference_id ON plotmethod  (reference_id);
4847

  
4848

  
4849
--
4795 4850
-- Name: fki_specimenreplicate_museum_id; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4796 4851
--
4797 4852

  
......
5261 5316

  
5262 5317

  
5263 5318
--
5319
-- Name: plotmethod_accessioncode; Type: INDEX; Schema: public; Owner: -; Tablespace: 
5320
--
5321

  
5322
CREATE UNIQUE INDEX plotmethod_accessioncode ON plotmethod  (accessioncode);
5323

  
5324

  
5325
--
5264 5326
-- Name: project_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
5265 5327
--
5266 5328

  
......
5921 5983

  
5922 5984

  
5923 5985
--
5924
-- Name: locationevent_method_id; Type: FK CONSTRAINT; Schema: public; Owner: -
5986
-- Name: locationevent_parent_id; Type: FK CONSTRAINT; Schema: public; Owner: -
5925 5987
--
5926 5988

  
5927 5989
ALTER TABLE locationevent
5928
    ADD CONSTRAINT locationevent_method_id FOREIGN KEY (method_id) REFERENCES method(method_id) ON UPDATE CASCADE ON DELETE CASCADE;
5990
    ADD CONSTRAINT locationevent_parent_id FOREIGN KEY (parent_id) REFERENCES locationevent(locationevent_id) ON UPDATE CASCADE ON DELETE CASCADE;
5929 5991

  
5930 5992

  
5931 5993
--
5932
-- Name: locationevent_parent_id; Type: FK CONSTRAINT; Schema: public; Owner: -
5994
-- Name: locationevent_plotmethod_id; Type: FK CONSTRAINT; Schema: public; Owner: -
5933 5995
--
5934 5996

  
5935 5997
ALTER TABLE locationevent
5936
    ADD CONSTRAINT locationevent_parent_id FOREIGN KEY (parent_id) REFERENCES locationevent(locationevent_id) ON UPDATE CASCADE ON DELETE CASCADE;
5998
    ADD CONSTRAINT locationevent_plotmethod_id FOREIGN KEY (plotmethod_id) REFERENCES plotmethod(plotmethod_id) ON UPDATE CASCADE ON DELETE CASCADE;
5937 5999

  
5938 6000

  
5939 6001
--
......
6271 6333

  
6272 6334

  
6273 6335
--
6336
-- Name: plotmethod_method_id; Type: FK CONSTRAINT; Schema: public; Owner: -
6337
--
6338

  
6339
ALTER TABLE plotmethod
6340
    ADD CONSTRAINT plotmethod_method_id FOREIGN KEY (method_id) REFERENCES method(method_id) ON UPDATE CASCADE ON DELETE CASCADE;
6341

  
6342

  
6343
--
6344
-- Name: plotmethod_reference_id; Type: FK CONSTRAINT; Schema: public; Owner: -
6345
--
6346

  
6347

  
6348

  
6349

  
6350
--
6274 6351
-- Name: project_reference_id; Type: FK CONSTRAINT; Schema: public; Owner: -
6275 6352
--
6276 6353

  
schemas/vegbien_empty.sql
51 51
TRUNCATE plantstatus CASCADE;
52 52
TRUNCATE planttag CASCADE;
53 53
TRUNCATE plantusage CASCADE;
54
TRUNCATE plotmethod CASCADE;
54 55
TRUNCATE project CASCADE;
55 56
TRUNCATE projectcontributor CASCADE;
56 57
TRUNCATE reference CASCADE;
schemas/vegbien.sql
1254 1254
    sourceaccessioncode text,
1255 1255
    previous_id integer,
1256 1256
    dateaccuracy text,
1257
    method_id integer,
1257
    plotmethod_id integer,
1258 1258
    methodnarrative text,
1259 1259
    taxonoccurrencearea double precision,
1260 1260
    coverdispersion text,
......
2049 2049

  
2050 2050

  
2051 2051
--
2052
-- Name: plotmethod; Type: TABLE; Schema: public; Owner: -; Tablespace: 
2053
--
2054

  
2055
CREATE TABLE plotmethod (
2056
    plotmethod_id integer NOT NULL,
2057
    reference_id integer,
2058
    name text NOT NULL,
2059
    description text,
2060
    accessioncode text,
2061
    method_id integer,
2062
    shape text,
2063
    length text,
2064
    width text,
2065
    radius text,
2066
    area text
2067
);
2068

  
2069

  
2070
--
2071
-- Name: plotmethod_plotmethod_id_seq; Type: SEQUENCE; Schema: public; Owner: -
2072
--
2073

  
2074
CREATE SEQUENCE plotmethod_plotmethod_id_seq
2075
    START WITH 1
2076
    INCREMENT BY 1
2077
    NO MINVALUE
2078
    NO MAXVALUE
2079
    CACHE 1;
2080

  
2081

  
2082
--
2083
-- Name: plotmethod_plotmethod_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
2084
--
2085

  
2086
ALTER SEQUENCE plotmethod_plotmethod_id_seq OWNED BY plotmethod.plotmethod_id;
2087

  
2088

  
2089
--
2052 2090
-- Name: project; Type: TABLE; Schema: public; Owner: -; Tablespace: 
2053 2091
--
2054 2092

  
......
3688 3726

  
3689 3727

  
3690 3728
--
3729
-- Name: plotmethod_id; Type: DEFAULT; Schema: public; Owner: -
3730
--
3731

  
3732
ALTER TABLE plotmethod ALTER COLUMN plotmethod_id SET DEFAULT nextval('plotmethod_plotmethod_id_seq'::regclass);
3733

  
3734

  
3735
--
3691 3736
-- Name: project_id; Type: DEFAULT; Schema: public; Owner: -
3692 3737
--
3693 3738

  
......
4430 4475

  
4431 4476

  
4432 4477
--
4478
-- Name: plotmethod_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4479
--
4480

  
4481
ALTER TABLE ONLY plotmethod
4482
    ADD CONSTRAINT plotmethod_pkey PRIMARY KEY (plotmethod_id);
4483

  
4484

  
4485
--
4433 4486
-- Name: project_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4434 4487
--
4435 4488

  
......
5169 5222
-- Name: fki_locationevent_method_id; Type: INDEX; Schema: public; Owner: -; Tablespace: 
5170 5223
--
5171 5224

  
5172
CREATE INDEX fki_locationevent_method_id ON locationevent USING btree (method_id);
5225
CREATE INDEX fki_locationevent_method_id ON locationevent USING btree (plotmethod_id);
5173 5226

  
5174 5227

  
5175 5228
--
......
5236 5289

  
5237 5290

  
5238 5291
--
5292
-- Name: fki_plotmethod_reference_id; Type: INDEX; Schema: public; Owner: -; Tablespace: 
5293
--
5294

  
5295
CREATE INDEX fki_plotmethod_reference_id ON plotmethod USING btree (reference_id);
5296

  
5297

  
5298
--
5239 5299
-- Name: fki_specimenreplicate_museum_id; Type: INDEX; Schema: public; Owner: -; Tablespace: 
5240 5300
--
5241 5301

  
......
5705 5765

  
5706 5766

  
5707 5767
--
5768
-- Name: plotmethod_accessioncode; Type: INDEX; Schema: public; Owner: -; Tablespace: 
5769
--
5770

  
5771
CREATE UNIQUE INDEX plotmethod_accessioncode ON plotmethod USING btree (accessioncode);
5772

  
5773

  
5774
--
5708 5775
-- Name: project_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
5709 5776
--
5710 5777

  
......
6376 6443

  
6377 6444

  
6378 6445
--
6379
-- Name: locationevent_method_id; Type: FK CONSTRAINT; Schema: public; Owner: -
6446
-- Name: locationevent_parent_id; Type: FK CONSTRAINT; Schema: public; Owner: -
6380 6447
--
6381 6448

  
6382 6449
ALTER TABLE ONLY locationevent
6383
    ADD CONSTRAINT locationevent_method_id FOREIGN KEY (method_id) REFERENCES method(method_id) ON UPDATE CASCADE ON DELETE CASCADE;
6450
    ADD CONSTRAINT locationevent_parent_id FOREIGN KEY (parent_id) REFERENCES locationevent(locationevent_id) ON UPDATE CASCADE ON DELETE CASCADE;
6384 6451

  
6385 6452

  
6386 6453
--
6387
-- Name: locationevent_parent_id; Type: FK CONSTRAINT; Schema: public; Owner: -
6454
-- Name: locationevent_plotmethod_id; Type: FK CONSTRAINT; Schema: public; Owner: -
6388 6455
--
6389 6456

  
6390 6457
ALTER TABLE ONLY locationevent
6391
    ADD CONSTRAINT locationevent_parent_id FOREIGN KEY (parent_id) REFERENCES locationevent(locationevent_id) ON UPDATE CASCADE ON DELETE CASCADE;
6458
    ADD CONSTRAINT locationevent_plotmethod_id FOREIGN KEY (plotmethod_id) REFERENCES plotmethod(plotmethod_id) ON UPDATE CASCADE ON DELETE CASCADE;
6392 6459

  
6393 6460

  
6394 6461
--
......
6736 6803

  
6737 6804

  
6738 6805
--
6806
-- Name: plotmethod_method_id; Type: FK CONSTRAINT; Schema: public; Owner: -
6807
--
6808

  
6809
ALTER TABLE ONLY plotmethod
6810
    ADD CONSTRAINT plotmethod_method_id FOREIGN KEY (method_id) REFERENCES method(method_id) ON UPDATE CASCADE ON DELETE CASCADE;
6811

  
6812

  
6813
--
6814
-- Name: plotmethod_reference_id; Type: FK CONSTRAINT; Schema: public; Owner: -
6815
--
6816

  
6817
ALTER TABLE ONLY plotmethod
6818
    ADD CONSTRAINT plotmethod_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
6819

  
6820

  
6821
--
6739 6822
-- Name: project_reference_id; Type: FK CONSTRAINT; Schema: public; Owner: -
6740 6823
--
6741 6824

  

Also available in: Unified diff