Constraints

12 Foreign Key Constraints

Constraint Name Child Column Parent Column Delete Rule
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
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
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
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
offender_key_worker_allocation_reason_id_fkey
zz_archived_legacy_keyworker_allocation.allocation_reason_id
reference_data.id
Restrict delete
offender_key_worker_deallocation_reason_id_fkey
zz_archived_legacy_keyworker_allocation.deallocation_reason_id
reference_data.id
Restrict delete

Check Constraints

Table Constraint Name Constraint
allocation allocation_allocation_type ((allocation_type = ANY (ARRAY['A'::bpchar, 'M'::bpchar, 'P'::bpchar])))
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)))))
zz_archived_legacy_keyworker_allocation offender_key_worker_c1 ((alloc_type = ANY (ARRAY['A'::bpchar, 'M'::bpchar, 'P'::bpchar])))