#1140: Add multi-column creator/post indexes

This commit is contained in:
Toks
2013-11-30 15:01:07 -05:00
parent 344180a7bd
commit d8104d2500

View File

@@ -0,0 +1,17 @@
class AddCreatorIdAndPostIdIndexesToCommentsAndNotes < ActiveRecord::Migration
def self.up
execute "set statement_timeout = 0"
remove_index :comments, :creator_id
remove_index :notes, :creator_id
add_index :comments, [:creator_id, :post_id]
add_index :notes, [:creator_id, :post_id]
end
def self.down
execute "set statement_timeout = 0"
remove_index :comments, [:creator_id, :post_id]
remove_index :notes, [:creator_id, :post_id]
add_index :comments, :creator_id
add_index :notes, :creator_id
end
end