From f0d4e892794ebb33c3a08cd944efffaba8e0a4a8 Mon Sep 17 00:00:00 2001 From: Fosco Marotto Date: Sat, 12 Dec 2020 16:46:53 -0800 Subject: [PATCH] [migration] make this index creation conditional --- db/migrate/20200806162649_add_index_to_statuses_reply.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/db/migrate/20200806162649_add_index_to_statuses_reply.rb b/db/migrate/20200806162649_add_index_to_statuses_reply.rb index 8298dc61..b0d664cc 100644 --- a/db/migrate/20200806162649_add_index_to_statuses_reply.rb +++ b/db/migrate/20200806162649_add_index_to_statuses_reply.rb @@ -2,6 +2,8 @@ class AddIndexToStatusesReply < ActiveRecord::Migration[5.2] disable_ddl_transaction! def change - add_index :statuses, :reply, algorithm: :concurrently + if !index_exists?(:statuses, :reply) + add_index :statuses, :reply, algorithm: :concurrently + end end end