# class RemoveDuplicatedIndexOnAllTables

### Public Class Methods

down() click to toggle source

    # File lib/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() click to toggle source

    # File lib/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