Constraints

19 Foreign Key Constraints

Constraint Name Child Column Parent Column Delete Rule
recorded_event_policy_code_fkey
recorded_event.policy_code
policy.code
Restrict delete
recorded_event_type_id_fkey
recorded_event.type_id
reference_data.id
Restrict delete
prison_configuration_audit_rev_id_fkey
prison_configuration_audit.rev_id
audit_revision.id
Restrict delete
allocation_audit_rev_id_fkey
allocation_audit.rev_id
audit_revision.id
Restrict delete
recorded_event_audit_rev_id_fkey
recorded_event_audit.rev_id
audit_revision.id
Restrict delete
recorded_event_audit_policy_code_fkey
recorded_event_audit.policy_code
policy.code
Restrict delete
key_worker_status_id_fkey
staff_configuration.status_id
reference_data.id
Restrict delete
staff_configuration_policy_code_fkey
staff_configuration.policy_code
policy.code
Restrict delete
reference_data_policy_id_fkey
reference_data_policy.id
reference_data.id
Restrict delete
reference_data_policy_policy_code_fkey
reference_data_policy.policy_code
policy.code
Restrict delete
allocation_policy_code_fkey
allocation.policy_code
policy.code
Restrict delete
allocation_allocation_reason_id_fkey
allocation.allocation_reason_id
reference_data.id
Restrict delete
allocation_deallocation_reason_id_fkey
allocation.deallocation_reason_id
reference_data.id
Restrict delete
prison_configuration_policy_code_fkey
prison_configuration.policy_code
policy.code
Restrict delete
fk_prisoner_statistic_policy_code
prisoner_statistic.policy_code
policy.code
Restrict delete
fk_prisoner_statistic_id
prisoner_statistic.prison_statistic_id
prison_statistic.id
Restrict delete
staff_configuration_audit_rev_id_fkey
staff_configuration_audit.rev_id
audit_revision.id
Restrict delete
staff_role_audit_rev_id_fkey
staff_role_audit.rev_id
audit_revision.id
Restrict delete
prison_statistic_policy_code_fkey
prison_statistic.policy_code
policy.code
Restrict delete

Check Constraints

Table Constraint Name Constraint
allocation ch_allocation_is_active ((NOT ((is_active = true) AND ((deallocated_at IS NOT NULL) OR (deallocated_by IS NOT NULL) OR (deallocation_reason_id IS NOT NULL)))))
allocation ch_allocation_is_not_active ((NOT ((is_active = false) AND ((deallocated_at IS NULL) OR (deallocated_by IS NULL) OR (deallocation_reason_id IS NULL)))))
prison_configuration prison_config_allocation_order_valid (((allocation_order)::text = ANY ((ARRAY['BY_ALLOCATIONS'::character varying, 'BY_NAME'::character varying])::text[])))