Commit 64b1b297e9972504ab12f6ce4652eb23473797f3
1 parent
7b76f317
Exists in
master
and in
21 other branches
Index published to improve blog posts fetch
Showing
1 changed file
with
13 additions
and
0 deletions
Show diff stats
db/migrate/20140724180943_add_index_to_blog_posts_sort.rb
0 → 100644
| ... | ... | @@ -0,0 +1,13 @@ |
| 1 | +class AddIndexToBlogPostsSort < ActiveRecord::Migration | |
| 2 | + def self.up | |
| 3 | + %w[articles article_versions].each do |table| | |
| 4 | + add_index table, [:published_at, :id] | |
| 5 | + end | |
| 6 | + end | |
| 7 | + | |
| 8 | + def self.down | |
| 9 | + %w[articles article_versions].each do |table| | |
| 10 | + remove_index table, [:published_at, :id] | |
| 11 | + end | |
| 12 | + end | |
| 13 | +end | ... | ... |