1 class OwnerUuidIndex < ActiveRecord::Migration
2 def tables_with_owner_uuid
3 ActiveRecord::Base.connection.tables.select do |table|
4 columns = ActiveRecord::Base.connection.columns(table)
5 columns.collect(&:name).include? 'owner_uuid'
10 tables_with_owner_uuid.each do |table|
11 add_index table.to_sym, :owner_uuid
16 tables_with_owner_uuid.each do |table|
17 remove_index table.to_sym, :owner_uuid