Project

General

Profile

« Previous | Next » 

Revision 910

vegbien.sql: Added locationevent.parent_id for subplot events to point to their parent plot event

View differences:

schemas/vegbien.my.sql
1030 1030

  
1031 1031
CREATE TABLE locationevent (
1032 1032
    locationevent_id int(11) NOT NULL,
1033
    previous_id int(11),
1033
    parent_id int(11),
1034 1034
    location_id int(11),
1035 1035
    project_id int(11),
1036 1036
    authoreventcode text,
1037 1037
    accessioncode text,
1038 1038
    sourceaccessioncode text,
1039
    previous_id int(11),
1039 1040
    dateaccuracy text,
1040 1041
    covermethod_id int(11),
1041
    coverdispersion text,
1042
    autotaxoncover int(1),
1043 1042
    method_id int(11),
1044 1043
    methodnarrative text,
1045 1044
    taxonoccurrencearea double precision,
1045
    coverdispersion text,
1046
    autotaxoncover int(1),
1046 1047
    stemsizelimit double precision,
1047 1048
    stemarea double precision,
1048 1049
    stemsamplemethod text,
......
3865 3866

  
3866 3867

  
3867 3868
--
3868
-- Name: locationevent_keys_accessioncode; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3869
--
3870

  
3871
ALTER TABLE locationevent
3872
    ADD CONSTRAINT locationevent_keys_accessioncode UNIQUE (location_id, project_id, sourceaccessioncode);
3873

  
3874

  
3875
--
3876
-- Name: locationevent_keys_code; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3877
--
3878

  
3879
ALTER TABLE locationevent
3880
    ADD CONSTRAINT locationevent_keys_code UNIQUE (location_id, project_id, authoreventcode);
3881

  
3882

  
3883
--
3884 3869
-- Name: locationevent_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3885 3870
--
3886 3871

  
......
4832 4817

  
4833 4818

  
4834 4819
--
4820
-- Name: fki_locationevent_parent_id; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4821
--
4822

  
4823
CREATE INDEX fki_locationevent_parent_id ON locationevent  (parent_id);
4824

  
4825

  
4826
--
4835 4827
-- Name: fki_method_reference_id; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4836 4828
--
4837 4829

  
......
4986 4978

  
4987 4979

  
4988 4980
--
4981
-- Name: locationevent_keys_accessioncode; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4982
--
4983

  
4984

  
4985

  
4986

  
4987
--
4988
-- Name: locationevent_keys_code; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4989
--
4990

  
4991

  
4992

  
4993

  
4994
--
4989 4995
-- Name: locationevent_location_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4990 4996
--
4991 4997

  
......
6061 6067

  
6062 6068

  
6063 6069
--
6070
-- Name: locationevent_parent_id; Type: FK CONSTRAINT; Schema: public; Owner: -
6071
--
6072

  
6073
ALTER TABLE locationevent
6074
    ADD CONSTRAINT locationevent_parent_id FOREIGN KEY (parent_id) REFERENCES locationevent(locationevent_id) ON UPDATE CASCADE ON DELETE CASCADE;
6075

  
6076

  
6077
--
6064 6078
-- Name: locationevent_previousobs_id; Type: FK CONSTRAINT; Schema: public; Owner: -
6065 6079
--
6066 6080

  
schemas/vegbien.sql
1201 1201

  
1202 1202
CREATE TABLE locationevent (
1203 1203
    locationevent_id integer NOT NULL,
1204
    previous_id integer,
1204
    parent_id integer,
1205 1205
    location_id integer,
1206 1206
    project_id integer,
1207 1207
    authoreventcode text,
1208 1208
    accessioncode text,
1209 1209
    sourceaccessioncode text,
1210
    previous_id integer,
1210 1211
    dateaccuracy text,
1211 1212
    covermethod_id integer,
1212
    coverdispersion text,
1213
    autotaxoncover boolean,
1214 1213
    method_id integer,
1215 1214
    methodnarrative text,
1216 1215
    taxonoccurrencearea double precision,
1216
    coverdispersion text,
1217
    autotaxoncover boolean,
1217 1218
    stemsizelimit double precision,
1218 1219
    stemarea double precision,
1219 1220
    stemsamplemethod text,
......
4321 4322

  
4322 4323

  
4323 4324
--
4324
-- Name: locationevent_keys_accessioncode; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4325
--
4326

  
4327
ALTER TABLE ONLY locationevent
4328
    ADD CONSTRAINT locationevent_keys_accessioncode UNIQUE (location_id, project_id, sourceaccessioncode);
4329

  
4330

  
4331
--
4332
-- Name: locationevent_keys_code; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4333
--
4334

  
4335
ALTER TABLE ONLY locationevent
4336
    ADD CONSTRAINT locationevent_keys_code UNIQUE (location_id, project_id, authoreventcode);
4337

  
4338

  
4339
--
4340 4325
-- Name: locationevent_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4341 4326
--
4342 4327

  
......
5288 5273

  
5289 5274

  
5290 5275
--
5276
-- Name: fki_locationevent_parent_id; Type: INDEX; Schema: public; Owner: -; Tablespace: 
5277
--
5278

  
5279
CREATE INDEX fki_locationevent_parent_id ON locationevent USING btree (parent_id);
5280

  
5281

  
5282
--
5291 5283
-- Name: fki_method_reference_id; Type: INDEX; Schema: public; Owner: -; Tablespace: 
5292 5284
--
5293 5285

  
......
5442 5434

  
5443 5435

  
5444 5436
--
5437
-- Name: locationevent_keys_accessioncode; Type: INDEX; Schema: public; Owner: -; Tablespace: 
5438
--
5439

  
5440
CREATE UNIQUE INDEX locationevent_keys_accessioncode ON locationevent USING btree ((COALESCE(parent_id, 0)), location_id, project_id, sourceaccessioncode);
5441

  
5442

  
5443
--
5444
-- Name: locationevent_keys_code; Type: INDEX; Schema: public; Owner: -; Tablespace: 
5445
--
5446

  
5447
CREATE UNIQUE INDEX locationevent_keys_code ON locationevent USING btree ((COALESCE(parent_id, 0)), location_id, project_id, authoreventcode);
5448

  
5449

  
5450
--
5445 5451
-- Name: locationevent_location_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
5446 5452
--
5447 5453

  
......
6528 6534

  
6529 6535

  
6530 6536
--
6537
-- Name: locationevent_parent_id; Type: FK CONSTRAINT; Schema: public; Owner: -
6538
--
6539

  
6540
ALTER TABLE ONLY locationevent
6541
    ADD CONSTRAINT locationevent_parent_id FOREIGN KEY (parent_id) REFERENCES locationevent(locationevent_id) ON UPDATE CASCADE ON DELETE CASCADE;
6542

  
6543

  
6544
--
6531 6545
-- Name: locationevent_previousobs_id; Type: FK CONSTRAINT; Schema: public; Owner: -
6532 6546
--
6533 6547

  

Also available in: Unified diff