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-retrospec-0.12.2 vendor/gems/puppet-3.7.3/lib/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb
puppet-3.8.7 lib/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb
puppet-3.8.7-x86-mingw32 lib/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb
puppet-3.8.7-x64-mingw32 lib/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb
puppet-3.8.6 lib/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb
puppet-3.8.6-x86-mingw32 lib/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb
puppet-retrospec-0.12.1 vendor/gems/puppet-3.7.3/lib/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb
puppet-3.8.6-x64-mingw32 lib/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb
puppet-retrospec-0.12.0 vendor/gems/puppet-3.7.3/lib/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb
puppet-3.8.5 lib/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb
puppet-3.8.5-x86-mingw32 lib/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb
puppet-3.8.5-x64-mingw32 lib/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb
puppet-3.8.4 lib/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb
puppet-3.8.4-x86-mingw32 lib/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb
puppet-3.8.4-x64-mingw32 lib/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb
puppet-retrospec-0.11.0 vendor/gems/puppet-3.7.3/lib/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb
puppet-retrospec-0.10.0 vendor/gems/puppet-3.7.3/lib/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb
puppet-retrospec-0.9.1 vendor/gems/puppet-3.7.3/lib/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb
puppet-retrospec-0.9.0 vendor/gems/puppet-3.7.3/lib/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb
puppet-retrospec-0.8.1 vendor/gems/puppet-3.7.3/lib/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb