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