Project

General

Profile

« Previous | Next » 

Revision 1328

vegbien.sql: Moved plantconcept parent_id from plantstatus to plantconcept. plantconcept: Removed datasource-specific fields to make it globally unique (one plantconcept for each assigned parent taxon of a plantname, of which there will usually be just one)

View differences:

vegbien.my.sql
1346 1346

  
1347 1347
CREATE TABLE plantconcept (
1348 1348
    plantconcept_id int(11) NOT NULL,
1349
    parent_id int(11),
1350
    scope_id int(11),
1349 1351
    plantname_id int(11) NOT NULL,
1350
    reference_id int(11),
1351 1352
    plantcode text,
1352 1353
    plantdescription text,
1353
    d_obscount int(11),
1354
    d_currentaccepted int(1),
1355
    accessioncode text,
1356
    scope_id int(11)
1354
    accessioncode text
1357 1355
);
1358 1356

  
1359 1357

  
......
1524 1522
    plantstatus_id int(11) NOT NULL,
1525 1523
    plantconcept_id int(11) NOT NULL,
1526 1524
    party_id int(11),
1527
    plantparent_id int(11),
1528 1525
    plantconceptstatus text DEFAULT 'undetermined' NOT NULL,
1529 1526
    reference_id int(11),
1530 1527
    plantpartycomments text,
1531
    plantparentname text,
1532 1528
    startdate timestamp NULL,
1533 1529
    stopdate timestamp NULL,
1534 1530
    accessioncode text
......
3931 3927

  
3932 3928

  
3933 3929
--
3930
-- Name: fki_plantconcept_parent_id; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3931
--
3932

  
3933
CREATE INDEX fki_plantconcept_parent_id ON plantconcept  (parent_id);
3934

  
3935

  
3936
--
3934 3937
-- Name: fki_plantconcept_scope_id; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3935 3938
--
3936 3939

  
......
4302 4305

  
4303 4306

  
4304 4307
--
4305
-- Name: plantconcept_dobscount_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4306
--
4307

  
4308
CREATE INDEX plantconcept_dobscount_x ON plantconcept  (d_obscount);
4309

  
4310

  
4311
--
4312 4308
-- Name: plantconcept_plantname_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4313 4309
--
4314 4310

  
......
4316 4312

  
4317 4313

  
4318 4314
--
4319
-- Name: plantconcept_reference_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4320
--
4321

  
4322
CREATE INDEX plantconcept_reference_id_x ON plantconcept  (reference_id);
4323

  
4324

  
4325
--
4326 4315
-- Name: plantconcept_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4327 4316
--
4328 4317

  
......
4400 4389

  
4401 4390

  
4402 4391
--
4403
-- Name: plantstatus_plantparent_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4404
--
4405

  
4406
CREATE INDEX plantstatus_plantparent_id_x ON plantstatus  (plantparent_id);
4407

  
4408

  
4409
--
4410 4392
-- Name: plantstatus_reference_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4411 4393
--
4412 4394

  
......
5228 5210

  
5229 5211

  
5230 5212
--
5231
-- Name: plantconcept_plantname_id; Type: FK CONSTRAINT; Schema: public; Owner: -
5213
-- Name: plantconcept_parent_id; Type: FK CONSTRAINT; Schema: public; Owner: -
5232 5214
--
5233 5215

  
5234 5216
ALTER TABLE plantconcept
5235
    ADD CONSTRAINT plantconcept_plantname_id FOREIGN KEY (plantname_id) REFERENCES plantname(plantname_id) ON UPDATE CASCADE ON DELETE CASCADE;
5217
    ADD CONSTRAINT plantconcept_parent_id FOREIGN KEY (parent_id) REFERENCES plantconcept(plantconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;
5236 5218

  
5237 5219

  
5238 5220
--
5239
-- Name: plantconcept_reference_id; Type: FK CONSTRAINT; Schema: public; Owner: -
5221
-- Name: plantconcept_plantname_id; Type: FK CONSTRAINT; Schema: public; Owner: -
5240 5222
--
5241 5223

  
5224
ALTER TABLE plantconcept
5225
    ADD CONSTRAINT plantconcept_plantname_id FOREIGN KEY (plantname_id) REFERENCES plantname(plantname_id) ON UPDATE CASCADE ON DELETE CASCADE;
5242 5226

  
5243 5227

  
5244

  
5245 5228
--
5246 5229
-- Name: plantconcept_scope_id; Type: FK CONSTRAINT; Schema: public; Owner: -
5247 5230
--
......
5330 5313

  
5331 5314

  
5332 5315
--
5333
-- Name: plantstatus_plantparent_id; Type: FK CONSTRAINT; Schema: public; Owner: -
5334
--
5335

  
5336
ALTER TABLE plantstatus
5337
    ADD CONSTRAINT plantstatus_plantparent_id FOREIGN KEY (plantparent_id) REFERENCES plantconcept(plantconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;
5338

  
5339

  
5340
--
5341 5316
-- Name: plantstatus_reference_id; Type: FK CONSTRAINT; Schema: public; Owner: -
5342 5317
--
5343 5318

  

Also available in: Unified diff