Constraints

69 Foreign Key Constraints

Constraint Name Child Column Parent Column Delete Rule
fk_appointment_delivery_address_to_appointment_delivery
appointment_delivery_address.appointment_delivery_id
appointment_delivery.appointment_id
Restrict delete
fk_ended_by_id
referral.end_requested_by_id
auth_user.id
Restrict delete
fk_cancellation_reason_code
referral.end_requested_reason_code
cancellation_reason.code
Restrict delete
fk_withdrawal_reason_code
referral.withdrawal_reason_code
withdrawal_reason.code
Restrict delete
fk_sent_by_id
referral.sent_by_id
auth_user.id
Restrict delete
fk_intervention_id
referral.intervention_id
intervention.id
Restrict delete
fk_created_by_id
referral.created_by_id
auth_user.id
Restrict delete
fk_referral_desired_outcome_service_category_id
referral_desired_outcome.referral_id
referral_desired_outcome.service_category_id
referral_selected_service_category.referral_id
referral_selected_service_category.service_category_id
Restrict delete
fk__referral_desired_outcome__desired_outcome
referral_desired_outcome.desired_outcome_id
desired_outcome.id
Restrict delete
fk__referral_desired_outcome__referral
referral_desired_outcome.referral_id
draft_referral.id
Restrict delete
job_exec_params_fk
batch_job_execution_params.job_execution_id
batch_job_execution.job_execution_id
Restrict delete
fk__dynamic_framework_contract__service_provider_id
dynamic_framework_contract.prime_provider_id
service_provider.id
Restrict delete
fk__contract_type__contract_type_id
dynamic_framework_contract.contract_type_id
contract_type.id
Restrict delete
fk__dynamic_framework_contract__nps_region_id
dynamic_framework_contract.nps_region_id
nps_region.id
Restrict delete
fk__dynamic_framework_contract__pcc_region_id
dynamic_framework_contract.pcc_region_id
pcc_region.id
Restrict delete
fk_delivery_session_referral
delivery_session.referral_id
referral.id
Restrict delete
fk_referral_location_referral_id
referral_location.referral_id
referral.id
Restrict delete
job_exec_ctx_fk
batch_job_execution_context.job_execution_id
batch_job_execution.job_execution_id
Restrict delete
fk_attendance_submitted_by_id
appointment.attendance_submitted_by_id
auth_user.id
Restrict delete
fk_feedback_submitted_by
appointment.appointment_feedback_submitted_by_id
auth_user.id
Restrict delete
fk_appt_to_created_by
appointment.created_by_id
auth_user.id
Restrict delete
fk_attendance_behaviour_submitted_by_id
appointment.attendance_behaviour_submitted_by_id
auth_user.id
Restrict delete
fk_superseded_by_appoinment_id
appointment.superseded_by_appointment_id
appointment.id
Cascade on delete
fk__appointment__referral
appointment.referral_id
referral.id
Restrict delete
fk_session_feedback_submitted_by_id
appointment.session_feedback_submitted_by_id
auth_user.id
Restrict delete
fk_service_category_id
referral_selected_service_category.service_category_id
service_category.id
Restrict delete
fk_referral_id
referral_selected_service_category.referral_id
draft_referral.id
Restrict delete
fk_contract_type
contract_type_service_category.contract_type_id
contract_type.id
Restrict delete
fk_service_category_id
contract_type_service_category.service_category_id
service_category.id
Restrict delete
fk_supplier_assessment_referral
supplier_assessment.referral_id
referral.id
Restrict delete
fk_end_of_service_report_id
end_of_service_report_outcome.end_of_service_report_id
end_of_service_report.id
Restrict delete
fk_desired_outcome_id
end_of_service_report_outcome.desired_outcome_id
desired_outcome.id
Restrict delete
fk_probation_practitioner_details_referral_id
probation_practitioner_details.referral_id
referral.id
Restrict delete
fk_referral_id
referral_service_user_data.referral_id
draft_referral.id
Restrict delete
fk__intervention__dynamic_framework_contract_id
intervention.dynamic_framework_contract_id
dynamic_framework_contract.id
Restrict delete
fk_supplier_assessment_appointments_appointment_id
supplier_assessment_appointment.appointment_id
appointment.id
Restrict delete
fk_supplier_assessment_supplier_assessment
supplier_assessment_appointment.supplier_assessment_id
supplier_assessment.id
Restrict delete
job_exec_step_fk
batch_step_execution.job_execution_id
batch_job_execution.job_execution_id
Restrict delete
step_exec_ctx_fk
batch_step_execution_context.step_execution_id
batch_step_execution.step_execution_id
Restrict delete
changelog_referral_id_fkey
changelog.referral_id
referral.id
Restrict delete
changelog_changed_by_id_fkey
changelog.changed_by_id
auth_user.id
Restrict delete
fk_case_note_updated_by_id
draft_oasys_risk_information.updated_by_id
auth_user.id
Restrict delete
fk_draft_oasys_risk_information_referral_id
draft_oasys_risk_information.referral_id
draft_referral.id
Restrict delete
fk_service_category_id
complexity_level.service_category_id
service_category.id
Restrict delete
fk_referral_details_referral_id
referral_details.referral_id
draft_referral.id
Restrict delete
referral_details_superseded_by_id_fkey
referral_details.superseded_by_id
referral_details.id
Restrict delete
fk_action_plan_approved_by
action_plan.approved_by_id
auth_user.id
Restrict delete
fk_submitted_by_id
action_plan.submitted_by_id
auth_user.id
Restrict delete
fk_created_by_id
action_plan.created_by_id
auth_user.id
Restrict delete
fk_referral_id
action_plan.referral_id
referral.id
Restrict delete
fk_assigned_to_id_auth_user
referral_assignments.assigned_to_id
auth_user.id
Restrict delete
fk_assigned_by_id_auth_user
referral_assignments.assigned_by_id
auth_user.id
Restrict delete
fk_referral_id
referral_assignments.referral_id
referral.id
Restrict delete
fk_contract_id
dynamic_framework_contract_sub_contractor.dynamic_framework_contract_id
dynamic_framework_contract.id
Restrict delete
fk_subcontractor_id
dynamic_framework_contract_sub_contractor.subcontractor_provider_id
service_provider.id
Restrict delete
job_inst_exec_fk
batch_job_execution.job_instance_id
batch_job_instance.job_instance_id
Restrict delete
fk__pcc_region__nps_region_id
pcc_region.nps_region_id
nps_region.id
Restrict delete
fk_submitted_by_id
end_of_service_report.submitted_by_id
auth_user.id
Restrict delete
fk_created_by_id
end_of_service_report.created_by_id
auth_user.id
Restrict delete
fk_referral_id
end_of_service_report.referral_id
referral.id
Restrict delete
fk_appointment_delivery_to_appointment
appointment_delivery.appointment_id
appointment.id
Restrict delete
fk_case_note_referral_id
case_note.referral_id
referral.id
Restrict delete
fk_case_note_sent_by_id
case_note.sent_by_id
auth_user.id
Restrict delete
fk__desired_outcome__service_category
desired_outcome.service_category_id
service_category.id
Restrict delete
fk_delivery_session_appointment_delivery_session
delivery_session_appointment.delivery_session_id
delivery_session.id
Restrict delete
fk_delivery_session_appointment_appointment
delivery_session_appointment.appointment_id
appointment.id
Restrict delete
fk_referral_complexity_level_ids_complexity_level_ids_key
referral_complexity_level_ids.referral_id
referral_complexity_level_ids.complexity_level_ids_key
referral_selected_service_category.referral_id
referral_selected_service_category.service_category_id
Restrict delete
fk_referral_complexity_level_ids_referral_id
referral_complexity_level_ids.referral_id
draft_referral.id
Restrict delete
fk_action_plan_id
action_plan_activity.action_plan_id
action_plan.id
Restrict delete

Check Constraints

Table Constraint Name Constraint
appointment superseded_has_superseded_by_appoinment_id ((NOT ((superseded_by_appointment_id IS NULL) AND (superseded = true))))