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:

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