diff --git a/db/migrate/20180621013807_add_index_topic_id_percent_rank_on_posts.rb b/db/migrate/20180621013807_add_index_topic_id_percent_rank_on_posts.rb new file mode 100644 index 00000000000..d7a2f1f81d7 --- /dev/null +++ b/db/migrate/20180621013807_add_index_topic_id_percent_rank_on_posts.rb @@ -0,0 +1,9 @@ +class AddIndexTopicIdPercentRankOnPosts < ActiveRecord::Migration[5.2] + def up + add_index :posts, [:topic_id, :percent_rank], order: { percent_rank: :asc } + end + + def down + remove_index :posts, [:topic_id, :percent_rank] + end +end