From 0726e4346a744f1f562d218f908efcaba10a13d1 Mon Sep 17 00:00:00 2001 From: evazion Date: Wed, 13 Nov 2019 01:54:04 -0600 Subject: [PATCH] migrations: fix old migration not removing posts.uploader_ip_addr index. Bug: running migrations on a fresh database failed when we got to a migration adding a posts.uploader_ip_addr index on 2019-11-11. It failed because the index already existed. The index already existed because we used to have it at one point, until it was removed by another migration on 2015-01-20. This migration didn't correctly remove the index though, because it tried to remove a posts.source index first, which failed because this index didn't exist (it probably existed only in production). This error was swallowed, causing the migration to silently skip removing the posts.uploader_ip_addr index, which eventually blew up when we tried to add the index again later on. --- db/migrate/20150120005624_remove_unused_indexes.rb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/db/migrate/20150120005624_remove_unused_indexes.rb b/db/migrate/20150120005624_remove_unused_indexes.rb index 9c05aeecf..afdde3dd9 100644 --- a/db/migrate/20150120005624_remove_unused_indexes.rb +++ b/db/migrate/20150120005624_remove_unused_indexes.rb @@ -1,10 +1,7 @@ class RemoveUnusedIndexes < ActiveRecord::Migration[4.2] def change execute "set statement_timeout = 0" - begin - remove_index :posts, :source - remove_index :posts, :uploader_ip_addr - rescue ArgumentError - end + #remove_index :posts, :source + remove_index :posts, :uploader_ip_addr end end