1
0
mirror of https://github.com/mastodon/mastodon synced 2024-11-27 22:38:27 +09:00

Add missing on_delete: :cascade on notification_policies (#30251)

This commit is contained in:
Claire 2024-05-10 22:00:25 +02:00 committed by GitHub
parent 346530732c
commit 1959365c2f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 30 additions and 2 deletions

View File

@ -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

View File

@ -10,7 +10,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.1].define(version: 2024_03_22_161611) do ActiveRecord::Schema[7.1].define(version: 2024_05_10_192043) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
@ -1335,7 +1335,7 @@ ActiveRecord::Schema[7.1].define(version: 2024_03_22_161611) do
add_foreign_key "mutes", "accounts", name: "fk_b8d8daf315", on_delete: :cascade add_foreign_key "mutes", "accounts", name: "fk_b8d8daf315", on_delete: :cascade
add_foreign_key "notification_permissions", "accounts" add_foreign_key "notification_permissions", "accounts"
add_foreign_key "notification_permissions", "accounts", column: "from_account_id" add_foreign_key "notification_permissions", "accounts", column: "from_account_id"
add_foreign_key "notification_policies", "accounts" add_foreign_key "notification_policies", "accounts", on_delete: :cascade
add_foreign_key "notification_requests", "accounts", column: "from_account_id", on_delete: :cascade add_foreign_key "notification_requests", "accounts", column: "from_account_id", on_delete: :cascade
add_foreign_key "notification_requests", "accounts", on_delete: :cascade add_foreign_key "notification_requests", "accounts", on_delete: :cascade
add_foreign_key "notification_requests", "statuses", column: "last_status_id", on_delete: :nullify add_foreign_key "notification_requests", "statuses", column: "last_status_id", on_delete: :nullify