Skip to content

Commit

Permalink
Merge pull request #7330 from ministryofjustice/jsugarman/alter-benef…
Browse files Browse the repository at this point in the history
…it-check-result-fk

Fix: Add on delete cascade to benefit_check_result fk
  • Loading branch information
jsugarman authored Oct 18, 2024
2 parents 6e3581d + 255d3d1 commit 2f9ff1c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class AlterForeignKeyOnBenefitCheckResult < ActiveRecord::Migration[7.2]
def change
remove_foreign_key :benefit_check_results, :legal_aid_applications
add_foreign_key :benefit_check_results, :legal_aid_applications, on_delete: :cascade, validate: false
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class ValidateForeignKeyOnBenefitCheckResult < ActiveRecord::Migration[7.2]
def change
validate_foreign_key :benefit_check_results, :legal_aid_applications
end
end
4 changes: 2 additions & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.1].define(version: 2024_10_01_081701) do
ActiveRecord::Schema[7.2].define(version: 2024_10_18_071246) do
# These are extensions that must be enabled in order to support this database
enable_extension "pgcrypto"
enable_extension "plpgsql"
Expand Down Expand Up @@ -1102,7 +1102,7 @@
add_foreign_key "bank_errors", "applicants"
add_foreign_key "bank_providers", "applicants"
add_foreign_key "bank_transactions", "bank_accounts"
add_foreign_key "benefit_check_results", "legal_aid_applications"
add_foreign_key "benefit_check_results", "legal_aid_applications", on_delete: :cascade
add_foreign_key "ccms_submission_documents", "ccms_submissions", column: "submission_id"
add_foreign_key "ccms_submission_histories", "ccms_submissions", column: "submission_id"
add_foreign_key "ccms_submissions", "legal_aid_applications", on_delete: :cascade
Expand Down

0 comments on commit 2f9ff1c

Please sign in to comment.