module SchemaPlus::Indexes::Middleware::Migration::Column

Public Instance Methods

after(env) click to toggle source

Support :index option in Migration.add_column

# File lib/schema_plus/indexes/middleware/migration.rb, line 16
def after(env)
  return unless env.options[:index]
  case env.operation
  when :add, :record
    env.caller.add_index(env.table_name, env.column_name, env.options[:index])
  end
end
before(env) click to toggle source

Shortcuts

# File lib/schema_plus/indexes/middleware/migration.rb, line 8
def before(env)
  case env.options[:index]
  when true then env.options[:index] = {}
  when :unique then env.options[:index] = { :unique => true }
  end
end