diff --git a/db/migrate/20221214171836_fix_status_capability_tokens.rb b/db/migrate/20221214171836_fix_status_capability_tokens.rb new file mode 100644 index 000000000..526aad6d2 --- /dev/null +++ b/db/migrate/20221214171836_fix_status_capability_tokens.rb @@ -0,0 +1,21 @@ +class FixStatusCapabilityTokens < ActiveRecord::Migration[6.1] + def up + remove_foreign_key :status_capability_tokens, :statuses + add_foreign_key :status_capability_tokens, :statuses, on_delete: :cascade, validate: false + end + + def down + remove_foreign_key :status_capability_tokens, :statuses + add_foreign_key :status_capability_tokens, :statuses, validate: false + end +end + +class ValidateFixStatusCapabilityTokens < ActiveRecord::Migration[6.1] + def up + validate_foreign_key :status_capability_tokens, :statuses + end + + def down + validate_foreign_key :status_capability_tokens, :statuses + end +end diff --git a/db/schema.rb b/db/schema.rb index 606125e5f..a09ffcef9 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1246,7 +1246,7 @@ ActiveRecord::Schema.define(version: 2023_01_29_193248) do add_foreign_key "scheduled_statuses", "accounts", on_delete: :cascade add_foreign_key "session_activations", "oauth_access_tokens", column: "access_token_id", name: "fk_957e5bda89", on_delete: :cascade add_foreign_key "session_activations", "users", name: "fk_e5fda67334", on_delete: :cascade - add_foreign_key "status_capability_tokens", "statuses" + add_foreign_key "status_capability_tokens", "statuses", on_delete: :cascade add_foreign_key "status_expires", "statuses", on_delete: :cascade add_foreign_key "status_pins", "accounts", name: "fk_d4cb435b62", on_delete: :cascade add_foreign_key "status_pins", "statuses", on_delete: :cascade