mirror of
https://github.com/mastodon/mastodon.git
synced 2026-10-01 04:17:41 -05:00
Fix missing on_delete: :cascade on GeneratedAnnualReport foreign key (#40063)
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
class CreateGeneratedAnnualReports < ActiveRecord::Migration[7.1]
|
||||
def change
|
||||
create_table :generated_annual_reports do |t|
|
||||
t.belongs_to :account, null: false, foreign_key: { on_cascade: :delete }, index: false
|
||||
t.belongs_to :account, null: false, foreign_key: true, index: false
|
||||
t.integer :year, null: false
|
||||
t.jsonb :data, null: false
|
||||
t.integer :schema_version, null: false
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class FixGeneratedAnnualReportsForeignKey < ActiveRecord::Migration[8.1]
|
||||
def up
|
||||
safety_assured do
|
||||
execute 'ALTER TABLE generated_annual_reports DROP CONSTRAINT fk_rails_4ca37f035c, ADD CONSTRAINT fk_rails_4ca37f035c FOREIGN KEY (account_id) REFERENCES accounts(id) ON DELETE CASCADE;'
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
safety_assured do
|
||||
execute 'ALTER TABLE generated_annual_reports DROP CONSTRAINT fk_rails_4ca37f035c, ADD CONSTRAINT fk_rails_4ca37f035c FOREIGN KEY (account_id) REFERENCES accounts(id);'
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[8.1].define(version: 2026_08_04_081821) do
|
||||
ActiveRecord::Schema[8.1].define(version: 2026_08_05_130216) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "pg_catalog.plpgsql"
|
||||
|
||||
@@ -1551,7 +1551,7 @@ ActiveRecord::Schema[8.1].define(version: 2026_08_04_081821) do
|
||||
add_foreign_key "follow_requests", "accounts", name: "fk_76d644b0e7", on_delete: :cascade
|
||||
add_foreign_key "follows", "accounts", column: "target_account_id", name: "fk_745ca29eac", on_delete: :cascade
|
||||
add_foreign_key "follows", "accounts", name: "fk_32ed1b5560", on_delete: :cascade
|
||||
add_foreign_key "generated_annual_reports", "accounts"
|
||||
add_foreign_key "generated_annual_reports", "accounts", on_delete: :cascade
|
||||
add_foreign_key "global_follow_recommendations", "accounts", on_delete: :cascade
|
||||
add_foreign_key "identities", "users", name: "fk_bea040f377", on_delete: :cascade
|
||||
add_foreign_key "instance_moderation_notes", "accounts", on_delete: :cascade
|
||||
|
||||
Reference in New Issue
Block a user