REFACTOR: Reduce dependency on the post stream in TopicView.

This will allow us to drop the post stream from the payload for
mega-topics. On smaller topics, the extra query is fast because
of an existing index.
This commit is contained in:
Guo Xiang Tan
2018-07-10 15:42:48 +08:00
parent 59950b0f95
commit 21f333654c
2 changed files with 43 additions and 58 deletions

View File

@ -0,0 +1,5 @@
class AddIndexTopicIdSortOrderOnPosts < ActiveRecord::Migration[5.2]
def change
add_index :posts, [:topic_id, :sort_order], order: { sort_order: :asc }
end
end