wedding-planner/db/migrate/20250127190131_fix_cascading_wedding_deletion.rb
Manuel Bustillo 6100ce0b99
All checks were successful
Run unit tests / rubocop (pull_request) Successful in 48s
Run unit tests / check-licenses (pull_request) Successful in 55s
Run unit tests / copyright_notice (pull_request) Successful in 1m41s
Run unit tests / unit_tests (pull_request) Successful in 3m32s
Run unit tests / build-static-assets (pull_request) Successful in 35m56s
Make migration reversible
2025-06-01 19:57:14 +02:00

9 lines
307 B
Ruby

class FixCascadingWeddingDeletion < ActiveRecord::Migration[8.0]
def change
[:expenses, :groups, :guests, :seats, :tables_arrangements, :users].each do |table|
remove_foreign_key table, :weddings, column: :wedding_id
add_foreign_key table, :weddings, on_delete: :cascade
end
end
end