Module: HasUuid::ActiveRecord::ConnectionAdapters::Migration

Defined in:
lib/has_uuid/active_record/connection_adapters/migration.rb

Instance Method Summary collapse

Instance Method Details

#uuid(*column_names) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/has_uuid/active_record/connection_adapters/migration.rb', line 5

def uuid(*column_names)
  options = column_names.extract_options!
  column_names.each do |name|
    type = @base.adapter_name.downcase == 'postgresql' ? 'uuid' : 'binary(16)'
    column(name, "#{type}", options)
  end
end