DEV: Make sure chat migration is in plugin directory (#29867)

This migration is for chat so it needs to live in the chat plugin
directory.

Follow up to: 23a7f00524b696847f8c127679c0413ac8f736f9
This commit is contained in:
Blake Erickson
2024-11-20 14:50:15 -07:00
committed by GitHub
parent 13237b3e44
commit 1841e72571

View File

@ -0,0 +1,22 @@
# frozen_string_literal: true
class AddIndexToChatMessagesOnChatChannelId < ActiveRecord::Migration[7.1]
disable_ddl_transaction!
def up
# Transaction has been disabled so we need to clean up the invalid index if index creation timeout
execute <<~SQL
DROP INDEX CONCURRENTLY IF EXISTS index_chat_messages_on_chat_channel_id_and_id
SQL
execute <<~SQL
CREATE INDEX CONCURRENTLY index_chat_messages_on_chat_channel_id_and_id
ON chat_messages (chat_channel_id,id)
WHERE deleted_at IS NOT NULL
SQL
end
def down
raise ActiveRecord::IrreversibleMigration
end
end