FIX: add_directory_items_indexes causes migration to timeout on large databases, so create indexes concurrently

This commit is contained in:
Neil Lalonde 2016-10-25 15:30:21 -04:00
parent 478418e780
commit 6d68aac6eb
1 changed files with 9 additions and 7 deletions

View File

@ -1,11 +1,13 @@
class AddDirectoryItemsIndexes < ActiveRecord::Migration
disable_ddl_transaction!
def change
add_index :directory_items, :likes_received
add_index :directory_items, :likes_given
add_index :directory_items, :topics_entered
add_index :directory_items, :topic_count
add_index :directory_items, :post_count
add_index :directory_items, :posts_read
add_index :directory_items, :days_visited
add_index :directory_items, :likes_received, algorithm: :concurrently
add_index :directory_items, :likes_given, algorithm: :concurrently
add_index :directory_items, :topics_entered, algorithm: :concurrently
add_index :directory_items, :topic_count, algorithm: :concurrently
add_index :directory_items, :post_count, algorithm: :concurrently
add_index :directory_items, :posts_read, algorithm: :concurrently
add_index :directory_items, :days_visited, algorithm: :concurrently
end
end