cirandas.net

ref: master

db/migrate/20120820120000_index_parent_id_from_all_tables.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
class IndexParentIdFromAllTables < ActiveRecord::Migration
  def self.up
    add_index :article_versions, :parent_id
    add_index :categories, :parent_id
    add_index :images, :parent_id
    add_index :tags, :parent_id
    add_index :thumbnails, :parent_id
  end

  def self.down
    remove_index :article_versions, :parent_id
    remove_index :categories, :parent_id
    remove_index :images, :parent_id
    remove_index :tags, :parent_id
    remove_index :thumbnails, :parent_id
  end
end