cirandas.net

ref: master

db/migrate/20140724180943_add_index_to_blog_posts_sort.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
class AddIndexToBlogPostsSort < ActiveRecord::Migration
  def self.up
     %w[articles article_versions].each do |table|
      add_index table.to_sym, [:published_at, :id]
    end
 end

  def self.down
     %w[articles article_versions].each do |table|
      remove_index table.to_sym, [:published_at, :id]
    end
  end
end