Class: RemoveDuplicatedIndexOnAllTables
- Inherits:
-
ActiveRecord::Migration
- Object
- ActiveRecord::Migration
- RemoveDuplicatedIndexOnAllTables
- Defined in:
- lib/vendor/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb
Class Method Summary collapse
Class Method Details
.down ⇒ Object
8 9 10 11 12 |
# File 'lib/vendor/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb', line 8 def self.down ActiveRecord::Base.connection.tables.each do |t| add_index t.to_s, :id, :integer => true unless ActiveRecord::Base.connection.indexes(t).collect {|c| c.columns}.include?("id") end end |
.up ⇒ Object
2 3 4 5 6 |
# File 'lib/vendor/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb', line 2 def self.up ActiveRecord::Base.connection.tables.each do |t| remove_index t.to_s, :id if ActiveRecord::Base.connection.indexes(t).collect {|c| c.columns}.include?("id") end end |