Class: AddMissingIndexes

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/bumble/templates/migrations/add_missing_indexes.rb

Class Method Summary collapse

Class Method Details

.downObject



19
20
21
22
23
# File 'lib/generators/bumble/templates/migrations/add_missing_indexes.rb', line 19

def self.down
  # remove_index :posts, :permalink
  remove_index :comments, :post_id
  remove_index :posts, :column => [:id, :type]
end

.upObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/generators/bumble/templates/migrations/add_missing_indexes.rb', line 2

def self.up

  # These indexes were found by searching for AR::Base finds on your application
  # It is strongly recommanded that you will consult a professional DBA about your infrastucture and implemntation before
  # changing your database in that matter.
  # There is a possibility that some of the indexes offered below is not required and can be removed and not added, if you require
  # further assistance with your rails application, database infrastructure or any other problem, visit:
  #
  # http://www.railsmentors.org
  # http://www.railstutor.org
  # http://guides.rubyonrails.org

  add_index :posts, :permalink
  add_index :comments, :post_id
  add_index :posts, [:id, :type]
end