Fix: Add foreign key with delete cascade for destroy_async (#3527)

This commit is contained in:
Tejaswini Chile 2021-12-08 18:03:27 +05:30 committed by GitHub
parent f609a28c6b
commit 35130bc83e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 4 deletions

View file

@ -0,0 +1,12 @@
class UpdateContactInboxForeignKey < ActiveRecord::Migration[6.1]
def change
remove_foreign_key :contact_inboxes, :contacts
add_foreign_key :contact_inboxes, :contacts, on_delete: :cascade
remove_foreign_key :contact_inboxes, :inboxes
add_foreign_key :contact_inboxes, :inboxes, on_delete: :cascade
remove_foreign_key :conversations, :contact_inboxes
add_foreign_key :conversations, :contact_inboxes, on_delete: :cascade
end
end

View file

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2021_12_07_113102) do
ActiveRecord::Schema.define(version: 2021_12_08_085931) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_stat_statements"
@ -753,10 +753,10 @@ ActiveRecord::Schema.define(version: 2021_12_07_113102) do
add_foreign_key "agent_bots", "accounts"
add_foreign_key "campaigns", "accounts"
add_foreign_key "campaigns", "inboxes"
add_foreign_key "contact_inboxes", "contacts"
add_foreign_key "contact_inboxes", "inboxes"
add_foreign_key "contact_inboxes", "contacts", on_delete: :cascade
add_foreign_key "contact_inboxes", "inboxes", on_delete: :cascade
add_foreign_key "conversations", "campaigns"
add_foreign_key "conversations", "contact_inboxes"
add_foreign_key "conversations", "contact_inboxes", on_delete: :cascade
add_foreign_key "conversations", "teams"
add_foreign_key "csat_survey_responses", "accounts"
add_foreign_key "csat_survey_responses", "contacts"