Add missing on_delete: :cascade on notification_policies (#30251)
This commit is contained in:
1 parent
346530732c
commit
1959365c2f
2 files changed
+30
-2
No files matched your search
@@ -0,0 +1,28 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class FixNotificationPoliciesForeignKey < ActiveRecord::Migration[7.1]
|
||||
def up
|
||||
safety_assured do
|
||||
execute <<~SQL.squish
|
||||
ALTER TABLE notification_policies
|
||||
DROP CONSTRAINT fk_rails_506d62f0da,
|
||||
ADD CONSTRAINT fk_rails_506d62f0da
|
||||
FOREIGN KEY (account_id)
|
||||
REFERENCES accounts(id)
|
||||
ON DELETE CASCADE
|
||||
SQL
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
safety_assured do
|
||||
execute <<~SQL.squish
|
||||
ALTER TABLE notification_policies
|
||||
DROP CONSTRAINT fk_rails_506d62f0da,
|
||||
ADD CONSTRAINT fk_rails_506d62f0da
|
||||
FOREIGN KEY (account_id)
|
||||
REFERENCES accounts(id)
|
||||
SQL
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user