Constraints

11 Foreign Key Constraints

Constraint Name Child Column Parent Column Delete Rule
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
devices_facility_id_fkey
devices.facility_id
facilities.id
Cascade on delete
devices_parent_id_fkey
devices.parent_id
devices.id
Restrict delete
timeseries_values_timeseries_id_fkey
timeseries_values.timeseries_id
timeseries.id
Cascade on delete
device_templates_category_id_fkey
device_templates.category_id
device_template_categories.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
timeseries_type_id_fkey
timeseries.type_id
timeseries_types.id
Restrict delete
timeseries_device_id_fkey
timeseries.device_id
devices.id
Cascade on delete

Check Constraints

Table Constraint Name Constraint
facilities facilities_description_check ((description !~ 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))))
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)))
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)))
automations automations_description_check ((description !~ similar_to_escape(' *'::text)))
automations automations_timeseries_name_check ((timeseries_name !~ similar_to_escape(' *'::text)))
timeseries timeseries_decimal_places_check ((decimal_places >= 0))
timeseries timeseries_units_check ((units !~ similar_to_escape(' *'::text)))