From 0984763013bc18f62912d55bd3c12a83423b1b83 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Wed, 17 May 2017 09:18:49 +0800 Subject: [PATCH] Remove use of `rescue nil` in migration. --- db/migrate/20170515203721_add_public_type_to_topic_timers.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db/migrate/20170515203721_add_public_type_to_topic_timers.rb b/db/migrate/20170515203721_add_public_type_to_topic_timers.rb index 96665ce8ebf..168f2ac85d0 100644 --- a/db/migrate/20170515203721_add_public_type_to_topic_timers.rb +++ b/db/migrate/20170515203721_add_public_type_to_topic_timers.rb @@ -2,7 +2,7 @@ class AddPublicTypeToTopicTimers < ActiveRecord::Migration def up add_column :topic_timers, :public_type, :boolean, default: true - execute("drop index idx_topic_id_status_type_deleted_at") rescue nil + execute("DROP INDEX IF EXISTS idx_topic_id_status_type_deleted_at") # Only one public timer per topic (close, open, delete): execute <<~SQL @@ -14,7 +14,7 @@ class AddPublicTypeToTopicTimers < ActiveRecord::Migration end def down - execute "DROP INDEX idx_topic_id_public_type_deleted_at" + execute "DROP INDEX IF EXISTS idx_topic_id_public_type_deleted_at" execute <<~SQL CREATE UNIQUE INDEX idx_topic_id_status_type_deleted_at