Constraints

42 Foreign Key Constraints

Constraint Name Child Column Parent Column Delete Rule
accession_collectors_accession_id_fkey
accession_collectors.accession_id
accessions.id
Cascade on delete
geolocations_accession_id_fkey
geolocations.accession_id
accessions.id
Cascade on delete
accession_state_history_updated_by_fkey
accession_state_history.updated_by
users.id
Restrict delete
accession_state_history_old_state_id_fkey
accession_state_history.old_state_id
accession_states.id
Restrict delete
accession_state_history_new_state_id_fkey
accession_state_history.new_state_id
accession_states.id
Restrict delete
accession_state_history_accession_id_fkey
accession_state_history.accession_id
accessions.id
Cascade on delete
accessions_created_by_fkey
accessions.created_by
users.id
Restrict delete
accessions_facility_id_fkey
accessions.facility_id
facilities.id
Cascade on delete
accession_storage_location_id_fkey
accessions.sub_location_id
sub_locations.id
Restrict delete
accessions_latest_observed_units_id_fkey
accessions.latest_observed_units_id
seed_quantity_units.id
Restrict delete
accessions_collection_source_id_fkey
accessions.collection_source_id
collection_sources.id
Restrict delete
accessions_collection_site_country_code_fkey
accessions.collection_site_country_code
countries.code
Restrict delete
accession_subset_weight_units_id_fkey
accessions.subset_weight_units_id
seed_quantity_units.id
Restrict delete
accessions_modified_by_fkey
accessions.modified_by
users.id
Restrict delete
accessions_data_source_id_fkey
accessions.data_source_id
data_sources.id
Restrict delete
accessions_est_weight_units_id_fkey
accessions.est_weight_units_id
seed_quantity_units.id
Restrict delete
accession_remaining_units_id_fkey
accessions.remaining_units_id
seed_quantity_units.id
Restrict delete
accession_state_id_fkey
accessions.state_id
accession_states.id
Restrict delete
accessions_species_id_fkey
accessions.species_id
species.id
Restrict delete
accessions_project_id_fkey
accessions.project_id
projects.id
Null on delete
accessions_total_withdrawn_weight_units_id_fkey
accessions.total_withdrawn_weight_units_id
seed_quantity_units.id
Restrict delete
viability_tests_accession_id_fkey
viability_tests.accession_id
accessions.id
Cascade on delete
germination_test_substrate_id_fkey
viability_tests.substrate_id
viability_test_substrates.id
Restrict delete
germination_test_treatment_id_fkey
viability_tests.treatment_id
seed_treatments.id
Restrict delete
germination_test_seed_type_id_fkey
viability_tests.seed_type_id
viability_test_seed_types.id
Restrict delete
germination_test_test_type_fkey
viability_tests.test_type
viability_test_types.id
Restrict delete
viability_test_results_test_id_fkey
viability_test_results.test_id
viability_tests.id
Cascade on delete
bags_accession_id_fkey
bags.accession_id
accessions.id
Cascade on delete
accession_photo_accession_id_fkey
accession_photos.accession_id
accessions.id
Restrict delete
accession_photos_photo_id_fkey
accession_photos.file_id
files.id
Restrict delete
withdrawals_estimated_weight_units_id_fkey
withdrawals.estimated_weight_units_id
seed_quantity_units.id
Restrict delete
withdrawals_created_by_fkey
withdrawals.created_by
users.id
Restrict delete
withdrawal_purpose_id_fkey
withdrawals.purpose_id
withdrawal_purposes.id
Restrict delete
withdrawals_batch_id_fkey
withdrawals.batch_id
batches.id
Null on delete
withdrawals_accession_id_fkey
withdrawals.accession_id
accessions.id
Cascade on delete
withdrawal_withdrawn_units_id_fkey
withdrawals.withdrawn_units_id
seed_quantity_units.id
Restrict delete
withdrawals_withdrawn_by_fkey
withdrawals.withdrawn_by
users.id
Restrict delete
withdrawals_viability_test_id_fkey
withdrawals.viability_test_id
viability_tests.id
Cascade on delete
accession_quantity_history_remaining_units_id_fkey
accession_quantity_history.remaining_units_id
seed_quantity_units.id
Restrict delete
accession_quantity_history_history_type_id_fkey
accession_quantity_history.history_type_id
accession_quantity_history_types.id
Restrict delete
accession_quantity_history_accession_id_fkey
accession_quantity_history.accession_id
accessions.id
Cascade on delete
accession_quantity_history_created_by_fkey
accession_quantity_history.created_by
users.id
Restrict delete

Check Constraints

Table Constraint Name Constraint
accession_collectors accession_collectors_name_check ((name !~ similar_to_escape('\s*'::text)))
accession_collectors accession_collectors_position_check (("position" >= 0))
accessions accessions_collection_site_city_check ((collection_site_city !~ similar_to_escape(' *'::text)))
accessions accessions_collection_site_country_code_check ((collection_site_country_code !~ similar_to_escape(' *'::text)))
accessions accessions_collection_site_country_subdivision_check ((collection_site_country_subdivision !~ similar_to_escape(' *'::text)))
accessions accessions_collection_site_landowner_check ((collection_site_landowner !~ similar_to_escape(' *'::text)))
accessions accessions_collection_site_name_check ((collection_site_name !~ similar_to_escape(' *'::text)))
accessions accessions_collection_site_notes_check ((collection_site_notes !~ similar_to_escape(' *'::text)))
accessions accessions_founder_id_check ((founder_id !~ similar_to_escape(' *'::text)))
accessions accessions_number_check ((number !~ similar_to_escape(' *'::text)))
accessions accessions_processing_notes_check ((processing_notes !~ similar_to_escape(' *'::text)))
accessions observed_quantity_must_have_time ((((latest_observed_quantity IS NOT NULL) AND (latest_observed_time IS NOT NULL)) OR ((latest_observed_quantity IS NULL) AND (latest_observed_time IS NULL))))
accessions observed_quantity_must_have_units ((((latest_observed_quantity IS NOT NULL) AND (latest_observed_units_id IS NOT NULL)) OR ((latest_observed_quantity IS NULL) AND (latest_observed_units_id IS NULL))))
accessions remaining_quantity_must_have_units ((((remaining_quantity IS NOT NULL) AND (remaining_units_id IS NOT NULL)) OR ((remaining_quantity IS NULL) AND (remaining_units_id IS NULL))))
accessions subset_weight_quantity_must_have_units ((((subset_weight_quantity IS NOT NULL) AND (subset_weight_units_id IS NOT NULL)) OR ((subset_weight_quantity IS NULL) AND (subset_weight_units_id IS NULL))))
accessions subset_weight_units_must_not_be_seeds (((subset_weight_units_id <> 1) OR (subset_weight_units_id IS NULL)))
viability_tests viability_tests_notes_check ((notes !~ similar_to_escape(' *'::text)))
viability_tests viability_tests_staff_responsible_check ((staff_responsible !~ similar_to_escape(' *'::text)))
bags bags_bag_number_check ((bag_number !~ similar_to_escape(' *'::text)))
withdrawals estimated_weight_must_have_units ((((estimated_weight_quantity IS NOT NULL) AND (estimated_weight_units_id IS NOT NULL)) OR ((estimated_weight_quantity IS NULL) AND (estimated_weight_units_id IS NULL))))
withdrawals withdrawals_destination_check ((destination !~ similar_to_escape(' *'::text)))
withdrawals withdrawals_notes_check ((notes !~ similar_to_escape(' *'::text)))
withdrawals withdrawals_staff_responsible_check ((staff_responsible !~ similar_to_escape(' *'::text)))
withdrawals withdrawals_test_id_requires_purpose ((((viability_test_id IS NULL) AND ((purpose_id IS NULL) OR (purpose_id <> 7))) OR ((viability_test_id IS NOT NULL) AND (purpose_id IS NOT NULL) AND (purpose_id = 7))))
withdrawals withdrawals_viability_testing_has_test_id ((((purpose_id <> 7) AND (viability_test_id IS NULL)) OR ((purpose_id = 7) AND (viability_test_id IS NOT NULL))))