Files
danbooru/db/migrate/20150120005624_remove_unused_indexes.rb
evazion 0726e4346a 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.
2019-11-13 02:06:41 -06:00

8 lines
197 B
Ruby

class RemoveUnusedIndexes < ActiveRecord::Migration[4.2]
def change
execute "set statement_timeout = 0"
#remove_index :posts, :source
remove_index :posts, :uploader_ip_addr
end
end