mirror of
https://github.com/discourse/discourse.git
synced 2025-02-05 19:11:13 +00:00
7036a4295d
Why this change? Follow up to f880f1a42ffc39cd65eeaf318682b166290fd1d4. When adding an index concurrently where the database transaction is disabled, we have to ensure that we drop the index first if it exists because an invalid index can be created if the migration has failed before.
14 lines
336 B
Ruby
14 lines
336 B
Ruby
# frozen_string_literal: true
|
|
class TopicIdOnIncomingEmailIndex < ActiveRecord::Migration[7.0]
|
|
disable_ddl_transaction!
|
|
|
|
def up
|
|
remove_index :incoming_emails, :topic_id, if_exists: true
|
|
add_index :incoming_emails, :topic_id, algorithm: :concurrently
|
|
end
|
|
|
|
def down
|
|
raise ActiveRecord::IrreversibleMigration
|
|
end
|
|
end
|