Class: PruneIndexes

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
db/migrate/20110812000001_prune_indexes.rb

Class Method Summary collapse

Class Method Details

.downObject



17
18
19
20
21
# File 'db/migrate/20110812000001_prune_indexes.rb', line 17

def self.down
  add_index :hosts, :comments
  add_index :services, :info
  add_index :vulns, :info
end

.upObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'db/migrate/20110812000001_prune_indexes.rb', line 2

def self.up

  if indexes(:hosts).map{|x| x.columns }.flatten.include?("comments")
    remove_index :hosts, :comments
  end

  if indexes(:services).map{|x| x.columns }.flatten.include?("info")
    remove_index :services, :info
  end

  if indexes(:vulns).map{|x| x.columns }.flatten.include?("info")
    remove_index :vulns, :info
  end
end