Add cascade to foreign key of status_capability_tokens

This commit is contained in:
noellabo 2022-12-15 02:38:46 +09:00
parent e4bf21df6a
commit 8df4c78281
2 changed files with 22 additions and 1 deletions

View file

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

View file

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