PERF: index for deleted posts in a topic to speed up has_deleted detection

This commit is contained in:
Sam 2016-07-19 10:29:07 +10:00
parent 7d4aed66c7
commit a5d0e0f277
1 changed files with 5 additions and 0 deletions

View File

@ -0,0 +1,5 @@
class AddDeletedPostIndexToPosts < ActiveRecord::Migration
def change
add_index :posts, [:topic_id, :post_number], where: 'deleted_at IS NOT NULL', name: 'idx_posts_deleted_posts'
end
end