Sha256: da3c96e3f1c8fce690498adb274c2c7057a66904fcc95735ba101848914ba5a2

Contents?: true

Size: 481 Bytes

Versions: 170

Compression:

Stored size: 481 Bytes

Contents

class RemoveDuplicatedIndexOnAllTables < ActiveRecord::Migration
  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

  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
end

Version data entries

170 entries across 170 versions & 5 rubygems

Version Path
puppet-3.4.0.rc1 lib/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb
puppet-3.3.2 lib/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb
puppet-3.3.1 lib/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb
puppet-3.3.1.rc3 lib/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb
puppet-3.3.1.rc2 lib/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb
puppet-3.3.1.rc1 lib/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb
puppet-3.3.0 lib/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb
puppet-3.3.0.rc3 lib/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb
puppet-3.3.0.rc2 lib/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb
puppet-3.2.4 lib/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb
puppet-2.7.23 lib/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb
puppet-3.2.3 lib/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb
puppet-3.2.3.rc1 lib/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb
puppet-3.2.2 lib/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb
puppet-2.7.22 lib/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb
puppet-3.2.1 lib/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb
puppet-3.2.1.rc1 lib/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb
puppet-3.2.0.rc2 lib/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb
librarian-puppet-0.9.9 vendor/gems/ruby/1.9.1/gems/puppet-3.1.0/lib/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb
puppet-3.2.0.rc1 lib/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb