Constraints

104 Foreign Key Constraints

Constraint Name Child Column Parent Column Delete Rule
notification_types_notification_criticality_id_fkey
notification_types.notification_criticality_id
notification_criticalities.id
Restrict delete
species_wood_density_level_id_fkey
species.wood_density_level_id
wood_density_levels.id
Restrict delete
species_organization_id_fkey
species.organization_id
organizations.id
Cascade on delete
species_deleted_by_fkey
species.deleted_by
users.id
Restrict delete
species_created_by_fkey
species.created_by
users.id
Restrict delete
species_conservation_category_id_fkey
species.conservation_category_id
conservation_categories.id
Restrict delete
species_seed_storage_behavior_id_fkey
species.seed_storage_behavior_id
seed_storage_behaviors.id
Restrict delete
species_modified_by_fkey
species.modified_by
users.id
Restrict delete
organization_report_settings_organization_id_fkey
organization_report_settings.organization_id
organizations.id
Cascade on delete
project_report_settings_project_id_fkey
project_report_settings.project_id
projects.id
Cascade on delete
project_land_use_model_types_land_use_model_type_id_fkey
project_land_use_model_types.land_use_model_type_id
land_use_model_types.id
Restrict delete
project_land_use_model_types_project_id_fkey
project_land_use_model_types.project_id
projects.id
Cascade on delete
organizations_time_zone_fkey
organizations.time_zone
time_zones.time_zone
Null on delete
organizations_organization_type_id_fkey
organizations.organization_type_id
organization_types.id
Restrict delete
organizations_created_by_fkey
organizations.created_by
users.id
Restrict delete
organizations_country_code_fkey
organizations.country_code
countries.code
Restrict delete
organizations_country_subdivision_code_fkey
organizations.country_subdivision_code
country_subdivisions.code
Restrict delete
organizations_modified_by_fkey
organizations.modified_by
users.id
Restrict delete
reports_status_id_fkey
reports.status_id
report_statuses.id
Restrict delete
reports_organization_id_fkey
reports.organization_id
organizations.id
Restrict delete
reports_project_id_fkey
reports.project_id
projects.id
Null on delete
reports_locked_by_fkey
reports.locked_by
users.id
Restrict delete
reports_submitted_by_fkey
reports.submitted_by
users.id
Restrict delete
reports_modified_by_fkey
reports.modified_by
users.id
Restrict delete
identifier_sequences_organization_id_fkey
identifier_sequences.organization_id
organizations.id
Restrict delete
species_successional_groups_species_id_fkey
species_successional_groups.species_id
species.id
Cascade on delete
species_successional_groups_successional_group_id_fkey
species_successional_groups.successional_group_id
successional_groups.id
Restrict delete
countries_region_id_fkey
countries.region_id
regions.id
Restrict delete
species_growth_forms_growth_form_id_fkey
species_growth_forms.growth_form_id
growth_forms.id
Restrict delete
species_growth_forms_species_id_fkey
species_growth_forms.species_id
species.id
Cascade on delete
device_templates_category_id_fkey
device_templates.category_id
device_template_categories.id
Restrict delete
photos_modified_by_fkey
files.modified_by
users.id
Restrict delete
photos_user_id_fkey
files.created_by
users.id
Restrict delete
storage_locations_facility_id_fkey
sub_locations.facility_id
facilities.id
Cascade on delete
storage_locations_modified_by_fkey
sub_locations.modified_by
users.id
Restrict delete
storage_locations_created_by_fkey
sub_locations.created_by
users.id
Restrict delete
report_photos_report_id_fkey
report_photos.report_id
reports.id
Restrict delete
report_photos_photo_id_fkey
report_photos.file_id
files.id
Cascade on delete
country_subdivisions_country_code_fkey
country_subdivisions.country_code
countries.code
Restrict delete
user_global_roles_global_role_id_fkey
user_global_roles.global_role_id
global_roles.id
Cascade on delete
user_global_roles_user_id_fkey
user_global_roles.user_id
users.id
Cascade on delete
upload_problems_type_id_fkey
upload_problems.type_id
upload_problem_types.id
Restrict delete
upload_problems_upload_id_fkey
upload_problems.upload_id
uploads.id
Cascade on delete
internal_tags_modified_by_fkey
internal_tags.modified_by
users.id
Restrict delete
internal_tags_created_by_fkey
internal_tags.created_by
users.id
Restrict delete
species_plant_material_sourci_plant_material_sourcing_meth_fkey
species_plant_material_sourcing_methods.plant_material_sourcing_method_id
plant_material_sourcing_methods.id
Restrict delete
species_plant_material_sourcing_methods_species_id_fkey
species_plant_material_sourcing_methods.species_id
species.id
Cascade on delete
uploads_facility_id_fkey
uploads.facility_id
facilities.id
Restrict delete
uploads_status_id_fkey
uploads.status_id
upload_statuses.id
Restrict delete
uploads_organization_id_fkey
uploads.organization_id
organizations.id
Restrict delete
uploads_type_id_fkey
uploads.type_id
upload_types.id
Restrict delete
uploads_created_by_fkey
uploads.created_by
users.id
Restrict delete
timeseries_values_timeseries_id_fkey
timeseries_values.timeseries_id
timeseries.id
Cascade on delete
users_country_code_fkey
users.country_code
countries.code
Restrict delete
users_user_type_id_fkey
users.user_type_id
user_types.id
Restrict delete
users_time_zone_fkey
users.time_zone
time_zones.time_zone
Null on delete
organization_internal_tags_created_by_fkey
organization_internal_tags.created_by
users.id
Restrict delete
organization_internal_tags_organization_id_fkey
organization_internal_tags.organization_id
organizations.id
Cascade on delete
organization_internal_tags_internal_tag_id_fkey
organization_internal_tags.internal_tag_id
internal_tags.id
Cascade on delete
organization_managed_location_types_organization_id_fkey
organization_managed_location_types.organization_id
organizations.id
Cascade on delete
organization_managed_location_typ_managed_location_type_id_fkey
organization_managed_location_types.managed_location_type_id
managed_location_types.id
Restrict delete
user_preferences_user_id_fkey
user_preferences.user_id
users.id
Restrict delete
user_preferences_organization_id_fkey
user_preferences.organization_id
organizations.id
Cascade on delete
automations_created_by_fkey
automations.created_by
users.id
Restrict delete
automations_modified_by_fkey
automations.modified_by
users.id
Restrict delete
automations_device_id_fkey
automations.device_id
devices.id
Cascade on delete
automations_facility_id_fkey
automations.facility_id
facilities.id
Cascade on delete
species_problems_type_id_fkey
species_problems.type_id
species_problem_types.id
Restrict delete
species_problems_species_id_fkey
species_problems.species_id
species.id
Cascade on delete
species_problems_field_id_fkey
species_problems.field_id
species_problem_fields.id
Restrict delete
notifications_organization_id_fkey
notifications.organization_id
organizations.id
Cascade on delete
notifications_notification_type_id_fkey
notifications.notification_type_id
notification_types.id
Restrict delete
notifications_user_id_fkey
notifications.user_id
users.id
Restrict delete
organization_users_organization_id_fkey
organization_users.organization_id
organizations.id
Cascade on delete
organization_users_modified_by_fkey
organization_users.modified_by
users.id
Restrict delete
organization_users_created_by_fkey
organization_users.created_by
users.id
Restrict delete
organization_users_user_id_fkey
organization_users.user_id
users.id
Restrict delete
organization_users_role_id_fkey
organization_users.role_id
roles.id
Restrict delete
thumbnail_photo_id_fkey
thumbnails.file_id
files.id
Restrict delete
projects_participant_id_fkey
projects.participant_id
participants.id
Restrict delete
projects_country_code_fkey
projects.country_code
countries.code
Restrict delete
projects_created_by_fkey
projects.created_by
users.id
projects_organization_id_fkey
projects.organization_id
organizations.id
Restrict delete
projects_modified_by_fkey
projects.modified_by
users.id
facilities_modified_by_fkey
facilities.modified_by
users.id
Restrict delete
facilities_time_zone_fkey
facilities.time_zone
time_zones.time_zone
Null on delete
site_module_type_id_fkey
facilities.type_id
facility_types.id
Restrict delete
facilities_created_by_fkey
facilities.created_by
users.id
Restrict delete
facilities_connection_state_id_fkey
facilities.connection_state_id
facility_connection_states.id
Restrict delete
facilities_organization_id_fkey
facilities.organization_id
organizations.id
Cascade on delete
device_managers_facility_id_fkey
device_managers.facility_id
facilities.id
Restrict delete
device_managers_user_id_fkey
device_managers.user_id
users.id
Restrict delete
report_files_file_id_fkey
report_files.file_id
files.id
Cascade on delete
report_files_report_id_fkey
report_files.report_id
reports.id
Restrict delete
species_ecosystem_types_ecosystem_type_id_fkey
species_ecosystem_types.ecosystem_type_id
ecosystem_types.id
Restrict delete
species_ecosystem_types_species_id_fkey
species_ecosystem_types.species_id
species.id
Cascade on delete
devices_created_by_fkey
devices.created_by
users.id
Restrict delete
devices_facility_id_fkey
devices.facility_id
facilities.id
Cascade on delete
devices_modified_by_fkey
devices.modified_by
users.id
Restrict delete
devices_parent_id_fkey
devices.parent_id
devices.id
Restrict delete
timeseries_type_id_fkey
timeseries.type_id
timeseries_types.id
Restrict delete
timeseries_device_id_fkey
timeseries.device_id
devices.id
Cascade on delete
timeseries_modified_by_fkey
timeseries.modified_by
users.id
Restrict delete
timeseries_created_by_fkey
timeseries.created_by
users.id
Restrict delete

Check Constraints

Table Constraint Name Constraint
species species_common_name_check ((common_name !~ similar_to_escape(' *'::text)))
species species_family_name_check ((family_name !~ similar_to_escape(' *'::text)))
organizations country_code_matches_subdivision (((country_subdivision_code IS NULL) OR (substr(country_subdivision_code, 1, 2) = country_code)))
organizations organizations_country_code_check ((country_code !~ similar_to_escape(' *'::text)))
organizations organizations_country_subdivision_code_check ((country_subdivision_code !~ similar_to_escape(' *'::text)))
organizations organizations_description_check ((description !~ similar_to_escape(' *'::text)))
organizations other_type_details_null_or_not_empty (((organization_type_details IS NULL) OR ((organization_type_details)::text <> ''::text)))
organizations other_type_details_only_for_other ((((organization_type_details IS NULL) AND (organization_type_id <> 6)) OR ((organization_type_details IS NOT NULL) AND (organization_type_id = 6))))
reports cannot_submit_while_locked (((locked_time IS NULL) OR (submitted_time IS NULL)))
reports locked_by_and_time_both_set ((((locked_by IS NULL) AND (locked_time IS NULL)) OR ((locked_by IS NOT NULL) AND (locked_time IS NOT NULL))))
reports quarter_in_range (((quarter >= 1) AND (quarter <= 4)))
reports status_reflects_locked ((((locked_by IS NULL) AND (status_id <> 3)) OR ((locked_by IS NOT NULL) AND (status_id = 3))))
reports status_reflects_submitted ((((submitted_by IS NULL) AND (status_id <> 4)) OR ((submitted_by IS NOT NULL) AND (status_id = 4))))
reports submitted_by_and_time_both_set ((((submitted_by IS NULL) AND (submitted_time IS NULL)) OR ((submitted_by IS NOT NULL) AND (submitted_time IS NOT NULL))))
countries countries_code_caps ((code = upper(code)))
countries countries_code_length ((length(code) = 2))
device_templates device_templates_address_check ((address !~ similar_to_escape(' *'::text)))
device_templates device_templates_description_check ((description !~ similar_to_escape(' *'::text)))
device_templates device_templates_protocol_check ((protocol !~ similar_to_escape(' *'::text)))
files content_type_cannot_be_empty_string ((length(content_type) > 0))
files file_name_cannot_be_empty_string ((length(file_name) > 0))
country_subdivisions country_subdivisions_code_length (((length(code) >= 4) AND (length(code) <= 6)))
country_subdivisions country_subdivisions_code_matches_country ((substr(code, 1, 2) = country_code))
upload_problems upload_problems_field_check ((field !~ similar_to_escape(' *'::text)))
upload_problems upload_problems_message_check ((message !~ similar_to_escape(' *'::text)))
upload_problems upload_problems_value_check ((value !~ similar_to_escape(' *'::text)))
users users_auth_id_check ((auth_id !~ similar_to_escape(' *'::text)))
users users_first_name_check ((first_name !~ similar_to_escape(' *'::text)))
users users_last_name_check ((last_name !~ similar_to_escape(' *'::text)))
automations automations_description_check ((description !~ similar_to_escape(' *'::text)))
automations automations_timeseries_name_check ((timeseries_name !~ similar_to_escape(' *'::text)))
species_problems species_problems_suggested_value_check ((suggested_value !~ similar_to_escape(' *'::text)))
facilities facilities_description_check ((description !~ similar_to_escape(' *'::text)))
device_managers device_managers_user_iff_facility ((((user_id IS NOT NULL) AND (facility_id IS NOT NULL)) OR ((user_id IS NULL) AND (facility_id IS NULL))))
devices devices_address_check ((address !~ similar_to_escape(' *'::text)))
devices devices_protocol_check ((protocol !~ similar_to_escape(' *'::text)))
timeseries timeseries_decimal_places_check ((decimal_places >= 0))
timeseries timeseries_units_check ((units !~ similar_to_escape(' *'::text)))