Remove use of `rescue nil` in migration.

This commit is contained in:
Guo Xiang Tan 2017-05-17 09:18:49 +08:00
parent eccfab6a19
commit 0984763013
1 changed files with 2 additions and 2 deletions

View File

@ -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