Project

General

Profile

« Previous | Next » 

Revision 407

vegbien.sql: Set all FOREIGN KEY constraints to ON UPDATE CASCADE ON DELETE CASCADE

View differences:

vegbien.sql
5381 5381
--
5382 5382

  
5383 5383
ALTER TABLE ONLY collection
5384
    ADD CONSTRAINT collection_individualplant_id_fkey FOREIGN KEY (individualplant_id) REFERENCES individualplant(individualplant_id);
5384
    ADD CONSTRAINT collection_individualplant_id_fkey FOREIGN KEY (individualplant_id) REFERENCES individualplant(individualplant_id) ON UPDATE CASCADE ON DELETE CASCADE;
5385 5385

  
5386 5386

  
5387 5387
--
......
5389 5389
--
5390 5390

  
5391 5391
ALTER TABLE ONLY address
5392
    ADD CONSTRAINT r1address_party_id FOREIGN KEY (party_id) REFERENCES party(party_id);
5392
    ADD CONSTRAINT r1address_party_id FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
5393 5393

  
5394 5394

  
5395 5395
--
......
5397 5397
--
5398 5398

  
5399 5399
ALTER TABLE ONLY classcontributor
5400
    ADD CONSTRAINT r1classcontributor_commclass_id FOREIGN KEY (commclass_id) REFERENCES commclass(commclass_id);
5400
    ADD CONSTRAINT r1classcontributor_commclass_id FOREIGN KEY (commclass_id) REFERENCES commclass(commclass_id) ON UPDATE CASCADE ON DELETE CASCADE;
5401 5401

  
5402 5402

  
5403 5403
--
......
5405 5405
--
5406 5406

  
5407 5407
ALTER TABLE ONLY commclass
5408
    ADD CONSTRAINT r1commclass_observation_id FOREIGN KEY (plotevent_id) REFERENCES plotevent(plotevent_id);
5408
    ADD CONSTRAINT r1commclass_observation_id FOREIGN KEY (plotevent_id) REFERENCES plotevent(plotevent_id) ON UPDATE CASCADE ON DELETE CASCADE;
5409 5409

  
5410 5410

  
5411 5411
--
......
5413 5413
--
5414 5414

  
5415 5415
ALTER TABLE ONLY commconcept
5416
    ADD CONSTRAINT r1commconcept_commname_id FOREIGN KEY (commname_id) REFERENCES commname(commname_id);
5416
    ADD CONSTRAINT r1commconcept_commname_id FOREIGN KEY (commname_id) REFERENCES commname(commname_id) ON UPDATE CASCADE ON DELETE CASCADE;
5417 5417

  
5418 5418

  
5419 5419
--
......
5421 5421
--
5422 5422

  
5423 5423
ALTER TABLE ONLY commcorrelation
5424
    ADD CONSTRAINT r1commcorrelation_commstatus_id FOREIGN KEY (commstatus_id) REFERENCES commstatus(commstatus_id);
5424
    ADD CONSTRAINT r1commcorrelation_commstatus_id FOREIGN KEY (commstatus_id) REFERENCES commstatus(commstatus_id) ON UPDATE CASCADE ON DELETE CASCADE;
5425 5425

  
5426 5426

  
5427 5427
--
......
5429 5429
--
5430 5430

  
5431 5431
ALTER TABLE ONLY commdetermination
5432
    ADD CONSTRAINT r1commdetermination_commclass_id FOREIGN KEY (commclass_id) REFERENCES commclass(commclass_id);
5432
    ADD CONSTRAINT r1commdetermination_commclass_id FOREIGN KEY (commclass_id) REFERENCES commclass(commclass_id) ON UPDATE CASCADE ON DELETE CASCADE;
5433 5433

  
5434 5434

  
5435 5435
--
......
5437 5437
--
5438 5438

  
5439 5439
ALTER TABLE ONLY commlineage
5440
    ADD CONSTRAINT r1commlineage_parentcommstatus_id FOREIGN KEY (parentcommstatus_id) REFERENCES commstatus(commstatus_id);
5440
    ADD CONSTRAINT r1commlineage_parentcommstatus_id FOREIGN KEY (parentcommstatus_id) REFERENCES commstatus(commstatus_id) ON UPDATE CASCADE ON DELETE CASCADE;
5441 5441

  
5442 5442

  
5443 5443
--
......
5445 5445
--
5446 5446

  
5447 5447
ALTER TABLE ONLY commname
5448
    ADD CONSTRAINT r1commname_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id);
5448
    ADD CONSTRAINT r1commname_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
5449 5449

  
5450 5450

  
5451 5451
--
......
5453 5453
--
5454 5454

  
5455 5455
ALTER TABLE ONLY commstatus
5456
    ADD CONSTRAINT r1commstatus_commconcept_id FOREIGN KEY (commconcept_id) REFERENCES commconcept(commconcept_id);
5456
    ADD CONSTRAINT r1commstatus_commconcept_id FOREIGN KEY (commconcept_id) REFERENCES commconcept(commconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;
5457 5457

  
5458 5458

  
5459 5459
--
......
5461 5461
--
5462 5462

  
5463 5463
ALTER TABLE ONLY commusage
5464
    ADD CONSTRAINT r1commusage_commname_id FOREIGN KEY (commname_id) REFERENCES commname(commname_id);
5464
    ADD CONSTRAINT r1commusage_commname_id FOREIGN KEY (commname_id) REFERENCES commname(commname_id) ON UPDATE CASCADE ON DELETE CASCADE;
5465 5465

  
5466 5466

  
5467 5467
--
......
5469 5469
--
5470 5470

  
5471 5471
ALTER TABLE ONLY coverindex
5472
    ADD CONSTRAINT r1coverindex_covermethod_id FOREIGN KEY (covermethod_id) REFERENCES covermethod(covermethod_id);
5472
    ADD CONSTRAINT r1coverindex_covermethod_id FOREIGN KEY (covermethod_id) REFERENCES covermethod(covermethod_id) ON UPDATE CASCADE ON DELETE CASCADE;
5473 5473

  
5474 5474

  
5475 5475
--
......
5477 5477
--
5478 5478

  
5479 5479
ALTER TABLE ONLY covermethod
5480
    ADD CONSTRAINT r1covermethod_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id);
5480
    ADD CONSTRAINT r1covermethod_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
5481 5481

  
5482 5482

  
5483 5483
--
......
5485 5485
--
5486 5486

  
5487 5487
ALTER TABLE ONLY definedvalue
5488
    ADD CONSTRAINT r1definedvalue_userdefined_id FOREIGN KEY (userdefined_id) REFERENCES userdefined(userdefined_id);
5488
    ADD CONSTRAINT r1definedvalue_userdefined_id FOREIGN KEY (userdefined_id) REFERENCES userdefined(userdefined_id) ON UPDATE CASCADE ON DELETE CASCADE;
5489 5489

  
5490 5490

  
5491 5491
--
......
5493 5493
--
5494 5494

  
5495 5495
ALTER TABLE ONLY disturbanceobs
5496
    ADD CONSTRAINT r1disturbanceobs_observation_id FOREIGN KEY (plotevent_id) REFERENCES plotevent(plotevent_id);
5496
    ADD CONSTRAINT r1disturbanceobs_observation_id FOREIGN KEY (plotevent_id) REFERENCES plotevent(plotevent_id) ON UPDATE CASCADE ON DELETE CASCADE;
5497 5497

  
5498 5498

  
5499 5499
--
......
5501 5501
--
5502 5502

  
5503 5503
ALTER TABLE ONLY embargo
5504
    ADD CONSTRAINT r1embargo_plot_id FOREIGN KEY (plot_id) REFERENCES plot(plot_id);
5504
    ADD CONSTRAINT r1embargo_plot_id FOREIGN KEY (plot_id) REFERENCES plot(plot_id) ON UPDATE CASCADE ON DELETE CASCADE;
5505 5505

  
5506 5506

  
5507 5507
--
......
5509 5509
--
5510 5510

  
5511 5511
ALTER TABLE ONLY graphic
5512
    ADD CONSTRAINT r1graphic_observation_id FOREIGN KEY (plotevent_id) REFERENCES plotevent(plotevent_id);
5512
    ADD CONSTRAINT r1graphic_observation_id FOREIGN KEY (plotevent_id) REFERENCES plotevent(plotevent_id) ON UPDATE CASCADE ON DELETE CASCADE;
5513 5513

  
5514 5514

  
5515 5515
--
......
5517 5517
--
5518 5518

  
5519 5519
ALTER TABLE ONLY individualplant
5520
    ADD CONSTRAINT r1individualplant_taxonimportance_id FOREIGN KEY (collectiveobservation_id) REFERENCES collectiveobservation(collectiveobservation_id);
5520
    ADD CONSTRAINT r1individualplant_taxonimportance_id FOREIGN KEY (collectiveobservation_id) REFERENCES collectiveobservation(collectiveobservation_id) ON UPDATE CASCADE ON DELETE CASCADE;
5521 5521

  
5522 5522

  
5523 5523
--
......
5525 5525
--
5526 5526

  
5527 5527
ALTER TABLE ONLY namedplace
5528
    ADD CONSTRAINT r1namedplace_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id);
5528
    ADD CONSTRAINT r1namedplace_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
5529 5529

  
5530 5530

  
5531 5531
--
......
5533 5533
--
5534 5534

  
5535 5535
ALTER TABLE ONLY namedplacecorrelation
5536
    ADD CONSTRAINT r1namedplacecorrelation_parentplace_id FOREIGN KEY (parentplace_id) REFERENCES namedplace(namedplace_id);
5536
    ADD CONSTRAINT r1namedplacecorrelation_parentplace_id FOREIGN KEY (parentplace_id) REFERENCES namedplace(namedplace_id) ON UPDATE CASCADE ON DELETE CASCADE;
5537 5537

  
5538 5538

  
5539 5539
--
......
5541 5541
--
5542 5542

  
5543 5543
ALTER TABLE ONLY note
5544
    ADD CONSTRAINT r1note_notelink_id FOREIGN KEY (notelink_id) REFERENCES notelink(notelink_id);
5544
    ADD CONSTRAINT r1note_notelink_id FOREIGN KEY (notelink_id) REFERENCES notelink(notelink_id) ON UPDATE CASCADE ON DELETE CASCADE;
5545 5545

  
5546 5546

  
5547 5547
--
......
5549 5549
--
5550 5550

  
5551 5551
ALTER TABLE ONLY plotevent
5552
    ADD CONSTRAINT r1observation_previousobs_id FOREIGN KEY (previousobs_id) REFERENCES plotevent(plotevent_id);
5552
    ADD CONSTRAINT r1observation_previousobs_id FOREIGN KEY (previousobs_id) REFERENCES plotevent(plotevent_id) ON UPDATE CASCADE ON DELETE CASCADE;
5553 5553

  
5554 5554

  
5555 5555
--
......
5557 5557
--
5558 5558

  
5559 5559
ALTER TABLE ONLY observationcontributor
5560
    ADD CONSTRAINT r1observationcontributor_observation_id FOREIGN KEY (plotevent_id) REFERENCES plotevent(plotevent_id);
5560
    ADD CONSTRAINT r1observationcontributor_observation_id FOREIGN KEY (plotevent_id) REFERENCES plotevent(plotevent_id) ON UPDATE CASCADE ON DELETE CASCADE;
5561 5561

  
5562 5562

  
5563 5563
--
......
5565 5565
--
5566 5566

  
5567 5567
ALTER TABLE ONLY observationsynonym
5568
    ADD CONSTRAINT r1observationsynonym_synonymobservation_id FOREIGN KEY (synonymobservation_id) REFERENCES plotevent(plotevent_id);
5568
    ADD CONSTRAINT r1observationsynonym_synonymobservation_id FOREIGN KEY (synonymobservation_id) REFERENCES plotevent(plotevent_id) ON UPDATE CASCADE ON DELETE CASCADE;
5569 5569

  
5570 5570

  
5571 5571
--
......
5573 5573
--
5574 5574

  
5575 5575
ALTER TABLE ONLY party
5576
    ADD CONSTRAINT r1party_currentname_id FOREIGN KEY (currentname_id) REFERENCES party(party_id);
5576
    ADD CONSTRAINT r1party_currentname_id FOREIGN KEY (currentname_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
5577 5577

  
5578 5578

  
5579 5579
--
......
5581 5581
--
5582 5582

  
5583 5583
ALTER TABLE ONLY partymember
5584
    ADD CONSTRAINT r1partymember_parentparty_id FOREIGN KEY (parentparty_id) REFERENCES party(party_id);
5584
    ADD CONSTRAINT r1partymember_parentparty_id FOREIGN KEY (parentparty_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
5585 5585

  
5586 5586

  
5587 5587
--
......
5589 5589
--
5590 5590

  
5591 5591
ALTER TABLE ONLY place
5592
    ADD CONSTRAINT r1place_plot_id FOREIGN KEY (plot_id) REFERENCES plot(plot_id);
5592
    ADD CONSTRAINT r1place_plot_id FOREIGN KEY (plot_id) REFERENCES plot(plot_id) ON UPDATE CASCADE ON DELETE CASCADE;
5593 5593

  
5594 5594

  
5595 5595
--
......
5597 5597
--
5598 5598

  
5599 5599
ALTER TABLE ONLY plantconcept
5600
    ADD CONSTRAINT r1plantconcept_plantname_id FOREIGN KEY (plantname_id) REFERENCES plantname(plantname_id);
5600
    ADD CONSTRAINT r1plantconcept_plantname_id FOREIGN KEY (plantname_id) REFERENCES plantname(plantname_id) ON UPDATE CASCADE ON DELETE CASCADE;
5601 5601

  
5602 5602

  
5603 5603
--
......
5605 5605
--
5606 5606

  
5607 5607
ALTER TABLE ONLY plantcorrelation
5608
    ADD CONSTRAINT r1plantcorrelation_plantstatus_id FOREIGN KEY (plantstatus_id) REFERENCES plantstatus(plantstatus_id);
5608
    ADD CONSTRAINT r1plantcorrelation_plantstatus_id FOREIGN KEY (plantstatus_id) REFERENCES plantstatus(plantstatus_id) ON UPDATE CASCADE ON DELETE CASCADE;
5609 5609

  
5610 5610

  
5611 5611
--
......
5613 5613
--
5614 5614

  
5615 5615
ALTER TABLE ONLY plantlineage
5616
    ADD CONSTRAINT r1plantlineage_childplantstatus_id FOREIGN KEY (childplantstatus_id) REFERENCES plantstatus(plantstatus_id);
5616
    ADD CONSTRAINT r1plantlineage_childplantstatus_id FOREIGN KEY (childplantstatus_id) REFERENCES plantstatus(plantstatus_id) ON UPDATE CASCADE ON DELETE CASCADE;
5617 5617

  
5618 5618

  
5619 5619
--
......
5621 5621
--
5622 5622

  
5623 5623
ALTER TABLE ONLY plantname
5624
    ADD CONSTRAINT r1plantname_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id);
5624
    ADD CONSTRAINT r1plantname_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
5625 5625

  
5626 5626

  
5627 5627
--
......
5629 5629
--
5630 5630

  
5631 5631
ALTER TABLE ONLY plantstatus
5632
    ADD CONSTRAINT r1plantstatus_plantconcept_id FOREIGN KEY (plantconcept_id) REFERENCES plantconcept(plantconcept_id);
5632
    ADD CONSTRAINT r1plantstatus_plantconcept_id FOREIGN KEY (plantconcept_id) REFERENCES plantconcept(plantconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;
5633 5633

  
5634 5634

  
5635 5635
--
......
5637 5637
--
5638 5638

  
5639 5639
ALTER TABLE ONLY plantusage
5640
    ADD CONSTRAINT r1plantusage_plantname_id FOREIGN KEY (plantname_id) REFERENCES plantname(plantname_id);
5640
    ADD CONSTRAINT r1plantusage_plantname_id FOREIGN KEY (plantname_id) REFERENCES plantname(plantname_id) ON UPDATE CASCADE ON DELETE CASCADE;
5641 5641

  
5642 5642

  
5643 5643
--
......
5645 5645
--
5646 5646

  
5647 5647
ALTER TABLE ONLY plot
5648
    ADD CONSTRAINT r1plot_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id);
5648
    ADD CONSTRAINT r1plot_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
5649 5649

  
5650 5650

  
5651 5651
--
......
5653 5653
--
5654 5654

  
5655 5655
ALTER TABLE ONLY projectcontributor
5656
    ADD CONSTRAINT r1projectcontributor_project_id FOREIGN KEY (project_id) REFERENCES project(project_id);
5656
    ADD CONSTRAINT r1projectcontributor_project_id FOREIGN KEY (project_id) REFERENCES project(project_id) ON UPDATE CASCADE ON DELETE CASCADE;
5657 5657

  
5658 5658

  
5659 5659
--
......
5661 5661
--
5662 5662

  
5663 5663
ALTER TABLE ONLY reference
5664
    ADD CONSTRAINT r1reference_referencejournal_id FOREIGN KEY (referencejournal_id) REFERENCES referencejournal(referencejournal_id);
5664
    ADD CONSTRAINT r1reference_referencejournal_id FOREIGN KEY (referencejournal_id) REFERENCES referencejournal(referencejournal_id) ON UPDATE CASCADE ON DELETE CASCADE;
5665 5665

  
5666 5666

  
5667 5667
--
......
5669 5669
--
5670 5670

  
5671 5671
ALTER TABLE ONLY referencealtident
5672
    ADD CONSTRAINT r1referencealtident_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id);
5672
    ADD CONSTRAINT r1referencealtident_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
5673 5673

  
5674 5674

  
5675 5675
--
......
5677 5677
--
5678 5678

  
5679 5679
ALTER TABLE ONLY referencecontributor
5680
    ADD CONSTRAINT r1referencecontributor_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id);
5680
    ADD CONSTRAINT r1referencecontributor_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
5681 5681

  
5682 5682

  
5683 5683
--
......
5685 5685
--
5686 5686

  
5687 5687
ALTER TABLE ONLY referenceparty
5688
    ADD CONSTRAINT r1referenceparty_currentparty_id FOREIGN KEY (currentparty_id) REFERENCES referenceparty(referenceparty_id);
5688
    ADD CONSTRAINT r1referenceparty_currentparty_id FOREIGN KEY (currentparty_id) REFERENCES referenceparty(referenceparty_id) ON UPDATE CASCADE ON DELETE CASCADE;
5689 5689

  
5690 5690

  
5691 5691
--
......
5693 5693
--
5694 5694

  
5695 5695
ALTER TABLE ONLY revision
5696
    ADD CONSTRAINT r1revision_previousrevision_id FOREIGN KEY (previousrevision_id) REFERENCES revision(revision_id);
5696
    ADD CONSTRAINT r1revision_previousrevision_id FOREIGN KEY (previousrevision_id) REFERENCES revision(revision_id) ON UPDATE CASCADE ON DELETE CASCADE;
5697 5697

  
5698 5698

  
5699 5699
--
......
5701 5701
--
5702 5702

  
5703 5703
ALTER TABLE ONLY soilobs
5704
    ADD CONSTRAINT r1soilobs_observation_id FOREIGN KEY (plotevent_id) REFERENCES plotevent(plotevent_id);
5704
    ADD CONSTRAINT r1soilobs_observation_id FOREIGN KEY (plotevent_id) REFERENCES plotevent(plotevent_id) ON UPDATE CASCADE ON DELETE CASCADE;
5705 5705

  
5706 5706

  
5707 5707
--
......
5709 5709
--
5710 5710

  
5711 5711
ALTER TABLE ONLY soiltaxon
5712
    ADD CONSTRAINT r1soiltaxon_soilparent_id FOREIGN KEY (soilparent_id) REFERENCES soiltaxon(soiltaxon_id);
5712
    ADD CONSTRAINT r1soiltaxon_soilparent_id FOREIGN KEY (soilparent_id) REFERENCES soiltaxon(soiltaxon_id) ON UPDATE CASCADE ON DELETE CASCADE;
5713 5713

  
5714 5714

  
5715 5715
--
......
5717 5717
--
5718 5718

  
5719 5719
ALTER TABLE ONLY stemobservation
5720
    ADD CONSTRAINT r1stemlocation_individualplant_id FOREIGN KEY (individualplant_id) REFERENCES individualplant(individualplant_id);
5720
    ADD CONSTRAINT r1stemlocation_individualplant_id FOREIGN KEY (individualplant_id) REFERENCES individualplant(individualplant_id) ON UPDATE CASCADE ON DELETE CASCADE;
5721 5721

  
5722 5722

  
5723 5723
--
......
5725 5725
--
5726 5726

  
5727 5727
ALTER TABLE ONLY stratum
5728
    ADD CONSTRAINT r1stratum_observation_id FOREIGN KEY (plotevent_id) REFERENCES plotevent(plotevent_id);
5728
    ADD CONSTRAINT r1stratum_observation_id FOREIGN KEY (plotevent_id) REFERENCES plotevent(plotevent_id) ON UPDATE CASCADE ON DELETE CASCADE;
5729 5729

  
5730 5730

  
5731 5731
--
......
5733 5733
--
5734 5734

  
5735 5735
ALTER TABLE ONLY stratummethod
5736
    ADD CONSTRAINT r1stratummethod_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id);
5736
    ADD CONSTRAINT r1stratummethod_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
5737 5737

  
5738 5738

  
5739 5739
--
......
5741 5741
--
5742 5742

  
5743 5743
ALTER TABLE ONLY stratumtype
5744
    ADD CONSTRAINT r1stratumtype_stratummethod_id FOREIGN KEY (stratummethod_id) REFERENCES stratummethod(stratummethod_id);
5744
    ADD CONSTRAINT r1stratumtype_stratummethod_id FOREIGN KEY (stratummethod_id) REFERENCES stratummethod(stratummethod_id) ON UPDATE CASCADE ON DELETE CASCADE;
5745 5745

  
5746 5746

  
5747 5747
--
......
5749 5749
--
5750 5750

  
5751 5751
ALTER TABLE ONLY taxonalt
5752
    ADD CONSTRAINT r1taxonalt_taxondetermination_id FOREIGN KEY (taxondetermination_id) REFERENCES taxondetermination(taxondetermination_id);
5752
    ADD CONSTRAINT r1taxonalt_taxondetermination_id FOREIGN KEY (taxondetermination_id) REFERENCES taxondetermination(taxondetermination_id) ON UPDATE CASCADE ON DELETE CASCADE;
5753 5753

  
5754 5754

  
5755 5755
--
......
5757 5757
--
5758 5758

  
5759 5759
ALTER TABLE ONLY taxondetermination
5760
    ADD CONSTRAINT r1taxondetermination_taxonobservation_id FOREIGN KEY (taxonoccurrence_id) REFERENCES taxonoccurrence(taxonoccurrence_id);
5760
    ADD CONSTRAINT r1taxondetermination_taxonobservation_id FOREIGN KEY (taxonoccurrence_id) REFERENCES taxonoccurrence(taxonoccurrence_id) ON UPDATE CASCADE ON DELETE CASCADE;
5761 5761

  
5762 5762

  
5763 5763
--
......
5765 5765
--
5766 5766

  
5767 5767
ALTER TABLE ONLY collectiveobservation
5768
    ADD CONSTRAINT r1taxonimportance_taxonobservation_id FOREIGN KEY (taxonoccurrence_id) REFERENCES taxonoccurrence(taxonoccurrence_id);
5768
    ADD CONSTRAINT r1taxonimportance_taxonobservation_id FOREIGN KEY (taxonoccurrence_id) REFERENCES taxonoccurrence(taxonoccurrence_id) ON UPDATE CASCADE ON DELETE CASCADE;
5769 5769

  
5770 5770

  
5771 5771
--
......
5773 5773
--
5774 5774

  
5775 5775
ALTER TABLE ONLY taxonoccurrence
5776
    ADD CONSTRAINT r1taxonobservation_observation_id FOREIGN KEY (plotevent_id) REFERENCES plotevent(plotevent_id);
5776
    ADD CONSTRAINT r1taxonobservation_observation_id FOREIGN KEY (plotevent_id) REFERENCES plotevent(plotevent_id) ON UPDATE CASCADE ON DELETE CASCADE;
5777 5777

  
5778 5778

  
5779 5779
--
......
5781 5781
--
5782 5782

  
5783 5783
ALTER TABLE ONLY telephone
5784
    ADD CONSTRAINT r1telephone_party_id FOREIGN KEY (party_id) REFERENCES party(party_id);
5784
    ADD CONSTRAINT r1telephone_party_id FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
5785 5785

  
5786 5786

  
5787 5787
--
......
5789 5789
--
5790 5790

  
5791 5791
ALTER TABLE ONLY usercertification
5792
    ADD CONSTRAINT r1usercertification_usr_id FOREIGN KEY (usr_id) REFERENCES usr(usr_id);
5792
    ADD CONSTRAINT r1usercertification_usr_id FOREIGN KEY (usr_id) REFERENCES usr(usr_id) ON UPDATE CASCADE ON DELETE CASCADE;
5793 5793

  
5794 5794

  
5795 5795
--
......
5797 5797
--
5798 5798

  
5799 5799
ALTER TABLE ONLY userdataset
5800
    ADD CONSTRAINT r1userdataset_usr_id FOREIGN KEY (usr_id) REFERENCES usr(usr_id);
5800
    ADD CONSTRAINT r1userdataset_usr_id FOREIGN KEY (usr_id) REFERENCES usr(usr_id) ON UPDATE CASCADE ON DELETE CASCADE;
5801 5801

  
5802 5802

  
5803 5803
--
......
5805 5805
--
5806 5806

  
5807 5807
ALTER TABLE ONLY userdatasetitem
5808
    ADD CONSTRAINT r1userdatasetitem_userdataset_id FOREIGN KEY (userdataset_id) REFERENCES userdataset(userdataset_id);
5808
    ADD CONSTRAINT r1userdatasetitem_userdataset_id FOREIGN KEY (userdataset_id) REFERENCES userdataset(userdataset_id) ON UPDATE CASCADE ON DELETE CASCADE;
5809 5809

  
5810 5810

  
5811 5811
--
......
5813 5813
--
5814 5814

  
5815 5815
ALTER TABLE ONLY usernotify
5816
    ADD CONSTRAINT r1usernotify_usr_id FOREIGN KEY (usr_id) REFERENCES usr(usr_id);
5816
    ADD CONSTRAINT r1usernotify_usr_id FOREIGN KEY (usr_id) REFERENCES usr(usr_id) ON UPDATE CASCADE ON DELETE CASCADE;
5817 5817

  
5818 5818

  
5819 5819
--
......
5821 5821
--
5822 5822

  
5823 5823
ALTER TABLE ONLY userpermission
5824
    ADD CONSTRAINT r1userpermission_embargo_id FOREIGN KEY (embargo_id) REFERENCES embargo(embargo_id);
5824
    ADD CONSTRAINT r1userpermission_embargo_id FOREIGN KEY (embargo_id) REFERENCES embargo(embargo_id) ON UPDATE CASCADE ON DELETE CASCADE;
5825 5825

  
5826 5826

  
5827 5827
--
......
5829 5829
--
5830 5830

  
5831 5831
ALTER TABLE ONLY userpreference
5832
    ADD CONSTRAINT r1userpreference_usr_id FOREIGN KEY (usr_id) REFERENCES usr(usr_id);
5832
    ADD CONSTRAINT r1userpreference_usr_id FOREIGN KEY (usr_id) REFERENCES usr(usr_id) ON UPDATE CASCADE ON DELETE CASCADE;
5833 5833

  
5834 5834

  
5835 5835
--
......
5837 5837
--
5838 5838

  
5839 5839
ALTER TABLE ONLY userquery
5840
    ADD CONSTRAINT r1userquery_usr_id FOREIGN KEY (usr_id) REFERENCES usr(usr_id);
5840
    ADD CONSTRAINT r1userquery_usr_id FOREIGN KEY (usr_id) REFERENCES usr(usr_id) ON UPDATE CASCADE ON DELETE CASCADE;
5841 5841

  
5842 5842

  
5843 5843
--
......
5845 5845
--
5846 5846

  
5847 5847
ALTER TABLE ONLY userrecordowner
5848
    ADD CONSTRAINT r1userrecordowner_usr_id FOREIGN KEY (usr_id) REFERENCES usr(usr_id);
5848
    ADD CONSTRAINT r1userrecordowner_usr_id FOREIGN KEY (usr_id) REFERENCES usr(usr_id) ON UPDATE CASCADE ON DELETE CASCADE;
5849 5849

  
5850 5850

  
5851 5851
--
......
5853 5853
--
5854 5854

  
5855 5855
ALTER TABLE ONLY userregionalexp
5856
    ADD CONSTRAINT r1userregionalexp_usercertification_id FOREIGN KEY (usercertification_id) REFERENCES usercertification(usercertification_id);
5856
    ADD CONSTRAINT r1userregionalexp_usercertification_id FOREIGN KEY (usercertification_id) REFERENCES usercertification(usercertification_id) ON UPDATE CASCADE ON DELETE CASCADE;
5857 5857

  
5858 5858

  
5859 5859
--
......
5861 5861
--
5862 5862

  
5863 5863
ALTER TABLE ONLY usr
5864
    ADD CONSTRAINT r1usr_party_id FOREIGN KEY (party_id) REFERENCES party(party_id);
5864
    ADD CONSTRAINT r1usr_party_id FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
5865 5865

  
5866 5866

  
5867 5867
--
......
5869 5869
--
5870 5870

  
5871 5871
ALTER TABLE ONLY address
5872
    ADD CONSTRAINT r2address_organization_id FOREIGN KEY (organization_id) REFERENCES party(party_id);
5872
    ADD CONSTRAINT r2address_organization_id FOREIGN KEY (organization_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
5873 5873

  
5874 5874

  
5875 5875
--
......
5877 5877
--
5878 5878

  
5879 5879
ALTER TABLE ONLY classcontributor
5880
    ADD CONSTRAINT r2classcontributor_party_id FOREIGN KEY (party_id) REFERENCES party(party_id);
5880
    ADD CONSTRAINT r2classcontributor_party_id FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
5881 5881

  
5882 5882

  
5883 5883
--
......
5885 5885
--
5886 5886

  
5887 5887
ALTER TABLE ONLY commclass
5888
    ADD CONSTRAINT r2commclass_classpublication_id FOREIGN KEY (classpublication_id) REFERENCES reference(reference_id);
5888
    ADD CONSTRAINT r2commclass_classpublication_id FOREIGN KEY (classpublication_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
5889 5889

  
5890 5890

  
5891 5891
--
......
5893 5893
--
5894 5894

  
5895 5895
ALTER TABLE ONLY commconcept
5896
    ADD CONSTRAINT r2commconcept_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id);
5896
    ADD CONSTRAINT r2commconcept_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
5897 5897

  
5898 5898

  
5899 5899
--
......
5901 5901
--
5902 5902

  
5903 5903
ALTER TABLE ONLY commcorrelation
5904
    ADD CONSTRAINT r2commcorrelation_commconcept_id FOREIGN KEY (commconcept_id) REFERENCES commconcept(commconcept_id);
5904
    ADD CONSTRAINT r2commcorrelation_commconcept_id FOREIGN KEY (commconcept_id) REFERENCES commconcept(commconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;
5905 5905

  
5906 5906

  
5907 5907
--
......
5909 5909
--
5910 5910

  
5911 5911
ALTER TABLE ONLY commdetermination
5912
    ADD CONSTRAINT r2commdetermination_commconcept_id FOREIGN KEY (commconcept_id) REFERENCES commconcept(commconcept_id);
5912
    ADD CONSTRAINT r2commdetermination_commconcept_id FOREIGN KEY (commconcept_id) REFERENCES commconcept(commconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;
5913 5913

  
5914 5914

  
5915 5915
--
......
5917 5917
--
5918 5918

  
5919 5919
ALTER TABLE ONLY commlineage
5920
    ADD CONSTRAINT r2commlineage_childcommstatus_id FOREIGN KEY (childcommstatus_id) REFERENCES commstatus(commstatus_id);
5920
    ADD CONSTRAINT r2commlineage_childcommstatus_id FOREIGN KEY (childcommstatus_id) REFERENCES commstatus(commstatus_id) ON UPDATE CASCADE ON DELETE CASCADE;
5921 5921

  
5922 5922

  
5923 5923
--
......
5925 5925
--
5926 5926

  
5927 5927
ALTER TABLE ONLY commstatus
5928
    ADD CONSTRAINT r2commstatus_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id);
5928
    ADD CONSTRAINT r2commstatus_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
5929 5929

  
5930 5930

  
5931 5931
--
......
5933 5933
--
5934 5934

  
5935 5935
ALTER TABLE ONLY commusage
5936
    ADD CONSTRAINT r2commusage_commconcept_id FOREIGN KEY (commconcept_id) REFERENCES commconcept(commconcept_id);
5936
    ADD CONSTRAINT r2commusage_commconcept_id FOREIGN KEY (commconcept_id) REFERENCES commconcept(commconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;
5937 5937

  
5938 5938

  
5939 5939
--
......
5941 5941
--
5942 5942

  
5943 5943
ALTER TABLE ONLY namedplacecorrelation
5944
    ADD CONSTRAINT r2namedplacecorrelation_childplace_id FOREIGN KEY (childplace_id) REFERENCES namedplace(namedplace_id);
5944
    ADD CONSTRAINT r2namedplacecorrelation_childplace_id FOREIGN KEY (childplace_id) REFERENCES namedplace(namedplace_id) ON UPDATE CASCADE ON DELETE CASCADE;
5945 5945

  
5946 5946

  
5947 5947
--
......
5949 5949
--
5950 5950

  
5951 5951
ALTER TABLE ONLY note
5952
    ADD CONSTRAINT r2note_party_id FOREIGN KEY (party_id) REFERENCES party(party_id);
5952
    ADD CONSTRAINT r2note_party_id FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
5953 5953

  
5954 5954

  
5955 5955
--
......
5957 5957
--
5958 5958

  
5959 5959
ALTER TABLE ONLY plotevent
5960
    ADD CONSTRAINT r2observation_plot_id FOREIGN KEY (plot_id) REFERENCES plot(plot_id);
5960
    ADD CONSTRAINT r2observation_plot_id FOREIGN KEY (plot_id) REFERENCES plot(plot_id) ON UPDATE CASCADE ON DELETE CASCADE;
5961 5961

  
5962 5962

  
5963 5963
--
......
5965 5965
--
5966 5966

  
5967 5967
ALTER TABLE ONLY observationcontributor
5968
    ADD CONSTRAINT r2observationcontributor_party_id FOREIGN KEY (party_id) REFERENCES party(party_id);
5968
    ADD CONSTRAINT r2observationcontributor_party_id FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
5969 5969

  
5970 5970

  
5971 5971
--
......
5973 5973
--
5974 5974

  
5975 5975
ALTER TABLE ONLY observationsynonym
5976
    ADD CONSTRAINT r2observationsynonym_primaryobservation_id FOREIGN KEY (primaryobservation_id) REFERENCES plotevent(plotevent_id);
5976
    ADD CONSTRAINT r2observationsynonym_primaryobservation_id FOREIGN KEY (primaryobservation_id) REFERENCES plotevent(plotevent_id) ON UPDATE CASCADE ON DELETE CASCADE;
5977 5977

  
5978 5978

  
5979 5979
--
......
5981 5981
--
5982 5982

  
5983 5983
ALTER TABLE ONLY partymember
5984
    ADD CONSTRAINT r2partymember_childparty_id FOREIGN KEY (childparty_id) REFERENCES party(party_id);
5984
    ADD CONSTRAINT r2partymember_childparty_id FOREIGN KEY (childparty_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
5985 5985

  
5986 5986

  
5987 5987
--
......
5989 5989
--
5990 5990

  
5991 5991
ALTER TABLE ONLY place
5992
    ADD CONSTRAINT r2place_namedplace_id FOREIGN KEY (namedplace_id) REFERENCES namedplace(namedplace_id);
5992
    ADD CONSTRAINT r2place_namedplace_id FOREIGN KEY (namedplace_id) REFERENCES namedplace(namedplace_id) ON UPDATE CASCADE ON DELETE CASCADE;
5993 5993

  
5994 5994

  
5995 5995
--
......
5997 5997
--
5998 5998

  
5999 5999
ALTER TABLE ONLY plantconcept
6000
    ADD CONSTRAINT r2plantconcept_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id);
6000
    ADD CONSTRAINT r2plantconcept_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
6001 6001

  
6002 6002

  
6003 6003
--
......
6005 6005
--
6006 6006

  
6007 6007
ALTER TABLE ONLY plantcorrelation
6008
    ADD CONSTRAINT r2plantcorrelation_plantconcept_id FOREIGN KEY (plantconcept_id) REFERENCES plantconcept(plantconcept_id);
6008
    ADD CONSTRAINT r2plantcorrelation_plantconcept_id FOREIGN KEY (plantconcept_id) REFERENCES plantconcept(plantconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;
6009 6009

  
6010 6010

  
6011 6011
--
......
6013 6013
--
6014 6014

  
6015 6015
ALTER TABLE ONLY plantlineage
6016
    ADD CONSTRAINT r2plantlineage_parentplantstatus_id FOREIGN KEY (parentplantstatus_id) REFERENCES plantstatus(plantstatus_id);
6016
    ADD CONSTRAINT r2plantlineage_parentplantstatus_id FOREIGN KEY (parentplantstatus_id) REFERENCES plantstatus(plantstatus_id) ON UPDATE CASCADE ON DELETE CASCADE;
6017 6017

  
6018 6018

  
6019 6019
--
......
6021 6021
--
6022 6022

  
6023 6023
ALTER TABLE ONLY plantstatus
6024
    ADD CONSTRAINT r2plantstatus_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id);
6024
    ADD CONSTRAINT r2plantstatus_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
6025 6025

  
6026 6026

  
6027 6027
--
......
6029 6029
--
6030 6030

  
6031 6031
ALTER TABLE ONLY plantusage
6032
    ADD CONSTRAINT r2plantusage_plantconcept_id FOREIGN KEY (plantconcept_id) REFERENCES plantconcept(plantconcept_id);
6032
    ADD CONSTRAINT r2plantusage_plantconcept_id FOREIGN KEY (plantconcept_id) REFERENCES plantconcept(plantconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;
6033 6033

  
6034 6034

  
6035 6035
--
......
6037 6037
--
6038 6038

  
6039 6039
ALTER TABLE ONLY plot
6040
    ADD CONSTRAINT r2plot_parent_id FOREIGN KEY (parent_id) REFERENCES plot(plot_id);
6040
    ADD CONSTRAINT r2plot_parent_id FOREIGN KEY (parent_id) REFERENCES plot(plot_id) ON UPDATE CASCADE ON DELETE CASCADE;
6041 6041

  
6042 6042

  
6043 6043
--
......
6045 6045
--
6046 6046

  
6047 6047
ALTER TABLE ONLY projectcontributor
6048
    ADD CONSTRAINT r2projectcontributor_party_id FOREIGN KEY (party_id) REFERENCES party(party_id);
6048
    ADD CONSTRAINT r2projectcontributor_party_id FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
6049 6049

  
6050 6050

  
6051 6051
--
......
6053 6053
--
6054 6054

  
6055 6055
ALTER TABLE ONLY referencecontributor
6056
    ADD CONSTRAINT r2referencecontributor_referenceparty_id FOREIGN KEY (referenceparty_id) REFERENCES referenceparty(referenceparty_id);
6056
    ADD CONSTRAINT r2referencecontributor_referenceparty_id FOREIGN KEY (referenceparty_id) REFERENCES referenceparty(referenceparty_id) ON UPDATE CASCADE ON DELETE CASCADE;
6057 6057

  
6058 6058

  
6059 6059
--
......
6061 6061
--
6062 6062

  
6063 6063
ALTER TABLE ONLY stratum
6064
    ADD CONSTRAINT r2stratum_stratumtype_id FOREIGN KEY (stratumtype_id) REFERENCES stratumtype(stratumtype_id);
6064
    ADD CONSTRAINT r2stratum_stratumtype_id FOREIGN KEY (stratumtype_id) REFERENCES stratumtype(stratumtype_id) ON UPDATE CASCADE ON DELETE CASCADE;
6065 6065

  
6066 6066

  
6067 6067
--
......
6069 6069
--
6070 6070

  
6071 6071
ALTER TABLE ONLY taxonalt
6072
    ADD CONSTRAINT r2taxonalt_plantconcept_id FOREIGN KEY (plantconcept_id) REFERENCES plantconcept(plantconcept_id);
6072
    ADD CONSTRAINT r2taxonalt_plantconcept_id FOREIGN KEY (plantconcept_id) REFERENCES plantconcept(plantconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;
6073 6073

  
6074 6074

  
6075 6075
--
......
6077 6077
--
6078 6078

  
6079 6079
ALTER TABLE ONLY taxondetermination
6080
    ADD CONSTRAINT r2taxondetermination_stemlocation_id FOREIGN KEY (stemobservation_id) REFERENCES stemobservation(stemobservation_id);
6080
    ADD CONSTRAINT r2taxondetermination_stemlocation_id FOREIGN KEY (stemobservation_id) REFERENCES stemobservation(stemobservation_id) ON UPDATE CASCADE ON DELETE CASCADE;
6081 6081

  
6082 6082

  
6083 6083
--
......
6085 6085
--
6086 6086

  
6087 6087
ALTER TABLE ONLY collectiveobservation
6088
    ADD CONSTRAINT r2taxonimportance_stratum_id FOREIGN KEY (stratum_id) REFERENCES stratum(stratum_id);
6088
    ADD CONSTRAINT r2taxonimportance_stratum_id FOREIGN KEY (stratum_id) REFERENCES stratum(stratum_id) ON UPDATE CASCADE ON DELETE CASCADE;
6089 6089

  
6090 6090

  
6091 6091
--
......
6093 6093
--
6094 6094

  
6095 6095
ALTER TABLE ONLY taxonoccurrence
6096
    ADD CONSTRAINT r2taxonobservation_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id);
6096
    ADD CONSTRAINT r2taxonobservation_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
6097 6097

  
6098 6098

  
6099 6099
--
......
6101 6101
--
6102 6102

  
6103 6103
ALTER TABLE ONLY userpermission
6104
    ADD CONSTRAINT r2userpermission_usr_id FOREIGN KEY (usr_id) REFERENCES usr(usr_id);
6104
    ADD CONSTRAINT r2userpermission_usr_id FOREIGN KEY (usr_id) REFERENCES usr(usr_id) ON UPDATE CASCADE ON DELETE CASCADE;
6105 6105

  
6106 6106

  
6107 6107
--
......
6109 6109
--
6110 6110

  
6111 6111
ALTER TABLE ONLY classcontributor
6112
    ADD CONSTRAINT r3classcontributor_role_id FOREIGN KEY (role_id) REFERENCES aux_role(role_id);
6112
    ADD CONSTRAINT r3classcontributor_role_id FOREIGN KEY (role_id) REFERENCES aux_role(role_id) ON UPDATE CASCADE ON DELETE CASCADE;
6113 6113

  
6114 6114

  
6115 6115
--
......
6117 6117
--
6118 6118

  
6119 6119
ALTER TABLE ONLY commdetermination
6120
    ADD CONSTRAINT r3commdetermination_commauthority_id FOREIGN KEY (commauthority_id) REFERENCES reference(reference_id);
6120
    ADD CONSTRAINT r3commdetermination_commauthority_id FOREIGN KEY (commauthority_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
6121 6121

  
6122 6122

  
6123 6123
--
......
6125 6125
--
6126 6126

  
6127 6127
ALTER TABLE ONLY commstatus
6128
    ADD CONSTRAINT r3commstatus_commparent_id FOREIGN KEY (commparent_id) REFERENCES commconcept(commconcept_id);
6128
    ADD CONSTRAINT r3commstatus_commparent_id FOREIGN KEY (commparent_id) REFERENCES commconcept(commconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;
6129 6129

  
6130 6130

  
6131 6131
--
......
6133 6133
--
6134 6134

  
6135 6135
ALTER TABLE ONLY commusage
6136
    ADD CONSTRAINT r3commusage_party_id FOREIGN KEY (party_id) REFERENCES party(party_id);
6136
    ADD CONSTRAINT r3commusage_party_id FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
6137 6137

  
6138 6138

  
6139 6139
--
......
6141 6141
--
6142 6142

  
6143 6143
ALTER TABLE ONLY note
6144
    ADD CONSTRAINT r3note_role_id FOREIGN KEY (role_id) REFERENCES aux_role(role_id);
6144
    ADD CONSTRAINT r3note_role_id FOREIGN KEY (role_id) REFERENCES aux_role(role_id) ON UPDATE CASCADE ON DELETE CASCADE;
6145 6145

  
6146 6146

  
6147 6147
--
......
6149 6149
--
6150 6150

  
6151 6151
ALTER TABLE ONLY plotevent
6152
    ADD CONSTRAINT r3observation_project_id FOREIGN KEY (project_id) REFERENCES project(project_id);
6152
    ADD CONSTRAINT r3observation_project_id FOREIGN KEY (project_id) REFERENCES project(project_id) ON UPDATE CASCADE ON DELETE CASCADE;
6153 6153

  
6154 6154

  
6155 6155
--
......
6157 6157
--
6158 6158

  
6159 6159
ALTER TABLE ONLY observationcontributor
6160
    ADD CONSTRAINT r3observationcontributor_role_id FOREIGN KEY (role_id) REFERENCES aux_role(role_id);
6160
    ADD CONSTRAINT r3observationcontributor_role_id FOREIGN KEY (role_id) REFERENCES aux_role(role_id) ON UPDATE CASCADE ON DELETE CASCADE;
6161 6161

  
6162 6162

  
6163 6163
--
......
6165 6165
--
6166 6166

  
6167 6167
ALTER TABLE ONLY observationsynonym
6168
    ADD CONSTRAINT r3observationsynonym_party_id FOREIGN KEY (party_id) REFERENCES party(party_id);
6168
    ADD CONSTRAINT r3observationsynonym_party_id FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
6169 6169

  
6170 6170

  
6171 6171
--
......
6173 6173
--
6174 6174

  
6175 6175
ALTER TABLE ONLY partymember
6176
    ADD CONSTRAINT r3partymember_role_id FOREIGN KEY (role_id) REFERENCES aux_role(role_id);
6176
    ADD CONSTRAINT r3partymember_role_id FOREIGN KEY (role_id) REFERENCES aux_role(role_id) ON UPDATE CASCADE ON DELETE CASCADE;
6177 6177

  
6178 6178

  
6179 6179
--
......
6181 6181
--
6182 6182

  
6183 6183
ALTER TABLE ONLY plantstatus
6184
    ADD CONSTRAINT r3plantstatus_plantparent_id FOREIGN KEY (plantparent_id) REFERENCES plantconcept(plantconcept_id);
6184
    ADD CONSTRAINT r3plantstatus_plantparent_id FOREIGN KEY (plantparent_id) REFERENCES plantconcept(plantconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;
6185 6185

  
6186 6186

  
6187 6187
--
......
6189 6189
--
6190 6190

  
6191 6191
ALTER TABLE ONLY plantusage
6192
    ADD CONSTRAINT r3plantusage_party_id FOREIGN KEY (party_id) REFERENCES party(party_id);
6192
    ADD CONSTRAINT r3plantusage_party_id FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
6193 6193

  
6194 6194

  
6195 6195
--
......
6197 6197
--
6198 6198

  
6199 6199
ALTER TABLE ONLY projectcontributor
6200
    ADD CONSTRAINT r3projectcontributor_role_id FOREIGN KEY (role_id) REFERENCES aux_role(role_id);
6200
    ADD CONSTRAINT r3projectcontributor_role_id FOREIGN KEY (role_id) REFERENCES aux_role(role_id) ON UPDATE CASCADE ON DELETE CASCADE;
6201 6201

  
6202 6202

  
6203 6203
--
......
6205 6205
--
6206 6206

  
6207 6207
ALTER TABLE ONLY stratum
6208
    ADD CONSTRAINT r3stratum_stratummethod_id FOREIGN KEY (stratummethod_id) REFERENCES stratummethod(stratummethod_id);
6208
    ADD CONSTRAINT r3stratum_stratummethod_id FOREIGN KEY (stratummethod_id) REFERENCES stratummethod(stratummethod_id) ON UPDATE CASCADE ON DELETE CASCADE;
6209 6209

  
6210 6210

  
6211 6211
--
......
6213 6213
--
6214 6214

  
6215 6215
ALTER TABLE ONLY taxondetermination
6216
    ADD CONSTRAINT r3taxondetermination_plantconcept_id FOREIGN KEY (plantconcept_id) REFERENCES plantconcept(plantconcept_id);
6216
    ADD CONSTRAINT r3taxondetermination_plantconcept_id FOREIGN KEY (plantconcept_id) REFERENCES plantconcept(plantconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;
6217 6217

  
6218 6218

  
6219 6219
--
......
6221 6221
--
6222 6222

  
6223 6223
ALTER TABLE ONLY commstatus
6224
    ADD CONSTRAINT r4commstatus_party_id FOREIGN KEY (party_id) REFERENCES party(party_id);
6224
    ADD CONSTRAINT r4commstatus_party_id FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
6225 6225

  
6226 6226

  
6227 6227
--
......
6229 6229
--
6230 6230

  
6231 6231
ALTER TABLE ONLY commusage
6232
    ADD CONSTRAINT r4commusage_commstatus_id FOREIGN KEY (commstatus_id) REFERENCES commstatus(commstatus_id);
6232
    ADD CONSTRAINT r4commusage_commstatus_id FOREIGN KEY (commstatus_id) REFERENCES commstatus(commstatus_id) ON UPDATE CASCADE ON DELETE CASCADE;
6233 6233

  
6234 6234

  
6235 6235
--
......
6237 6237
--
6238 6238

  
6239 6239
ALTER TABLE ONLY plotevent
6240
    ADD CONSTRAINT r4observation_covermethod_id FOREIGN KEY (covermethod_id) REFERENCES covermethod(covermethod_id);
6240
    ADD CONSTRAINT r4observation_covermethod_id FOREIGN KEY (covermethod_id) REFERENCES covermethod(covermethod_id) ON UPDATE CASCADE ON DELETE CASCADE;
6241 6241

  
6242 6242

  
6243 6243
--
......
6245 6245
--
6246 6246

  
6247 6247
ALTER TABLE ONLY observationsynonym
6248
    ADD CONSTRAINT r4observationsynonym_role_id FOREIGN KEY (role_id) REFERENCES aux_role(role_id);
6248
    ADD CONSTRAINT r4observationsynonym_role_id FOREIGN KEY (role_id) REFERENCES aux_role(role_id) ON UPDATE CASCADE ON DELETE CASCADE;
6249 6249

  
6250 6250

  
6251 6251
--
......
6253 6253
--
6254 6254

  
6255 6255
ALTER TABLE ONLY plantstatus
6256
    ADD CONSTRAINT r4plantstatus_party_id FOREIGN KEY (party_id) REFERENCES party(party_id);
6256
    ADD CONSTRAINT r4plantstatus_party_id FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
6257 6257

  
6258 6258

  
6259 6259
--
......
6261 6261
--
6262 6262

  
6263 6263
ALTER TABLE ONLY plantusage
6264
    ADD CONSTRAINT r4plantusage_plantstatus_id FOREIGN KEY (plantstatus_id) REFERENCES plantstatus(plantstatus_id);
6264
    ADD CONSTRAINT r4plantusage_plantstatus_id FOREIGN KEY (plantstatus_id) REFERENCES plantstatus(plantstatus_id) ON UPDATE CASCADE ON DELETE CASCADE;
6265 6265

  
6266 6266

  
6267 6267
--
......
6269 6269
--
6270 6270

  
6271 6271
ALTER TABLE ONLY taxondetermination
6272
    ADD CONSTRAINT r4taxondetermination_plantname_id FOREIGN KEY (plantname_id) REFERENCES plantname(plantname_id);
6272
    ADD CONSTRAINT r4taxondetermination_plantname_id FOREIGN KEY (plantname_id) REFERENCES plantname(plantname_id) ON UPDATE CASCADE ON DELETE CASCADE;
6273 6273

  
6274 6274

  
6275 6275
--
......
6277 6277
--
6278 6278

  
6279 6279
ALTER TABLE ONLY plotevent
6280
    ADD CONSTRAINT r5observation_stratummethod_id FOREIGN KEY (stratummethod_id) REFERENCES stratummethod(stratummethod_id);
6280
    ADD CONSTRAINT r5observation_stratummethod_id FOREIGN KEY (stratummethod_id) REFERENCES stratummethod(stratummethod_id) ON UPDATE CASCADE ON DELETE CASCADE;
6281 6281

  
6282 6282

  
6283 6283
--
......
6285 6285
--
6286 6286

  
6287 6287
ALTER TABLE ONLY taxondetermination
6288
    ADD CONSTRAINT r5taxondetermination_party_id FOREIGN KEY (party_id) REFERENCES party(party_id);
6288
    ADD CONSTRAINT r5taxondetermination_party_id FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
6289 6289

  
6290 6290

  
6291 6291
--
......
6293 6293
--
6294 6294

  
6295 6295
ALTER TABLE ONLY plotevent
6296
    ADD CONSTRAINT r6observation_soiltaxon_id FOREIGN KEY (soiltaxon_id) REFERENCES soiltaxon(soiltaxon_id);
6296
    ADD CONSTRAINT r6observation_soiltaxon_id FOREIGN KEY (soiltaxon_id) REFERENCES soiltaxon(soiltaxon_id) ON UPDATE CASCADE ON DELETE CASCADE;
6297 6297

  
6298 6298

  
6299 6299
--
......
6301 6301
--
6302 6302

  
6303 6303
ALTER TABLE ONLY taxondetermination
6304
    ADD CONSTRAINT r6taxondetermination_role_id FOREIGN KEY (role_id) REFERENCES aux_role(role_id);
6304
    ADD CONSTRAINT r6taxondetermination_role_id FOREIGN KEY (role_id) REFERENCES aux_role(role_id) ON UPDATE CASCADE ON DELETE CASCADE;
6305 6305

  
6306 6306

  
6307 6307
--
......
6309 6309
--
6310 6310

  
6311 6311
ALTER TABLE ONLY taxondetermination
6312
    ADD CONSTRAINT r7taxondetermination_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id);
6312
    ADD CONSTRAINT r7taxondetermination_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
6313 6313

  
6314 6314

  
6315 6315
--
......
6317 6317
--
6318 6318

  
6319 6319
ALTER TABLE ONLY taxondetermination
6320
    ADD CONSTRAINT r8taxondetermination_collector_id FOREIGN KEY (collector_id) REFERENCES party(party_id);
6320
    ADD CONSTRAINT r8taxondetermination_collector_id FOREIGN KEY (collector_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
6321 6321

  
6322 6322

  
6323 6323
--
......
6325 6325
--
6326 6326

  
6327 6327
ALTER TABLE ONLY taxondetermination
6328
    ADD CONSTRAINT r9taxondetermination_museum_id FOREIGN KEY (museum_id) REFERENCES party(party_id);
6328
    ADD CONSTRAINT r9taxondetermination_museum_id FOREIGN KEY (museum_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
6329 6329

  
6330 6330

  
6331 6331
--

Also available in: Unified diff