Module: ActiveUUID::Patches::Migrations

Defined in:
lib/activeuuid/patches.rb

Instance Method Summary collapse

Instance Method Details

#uuid(*column_names) ⇒ Object



47
48
49
50
51
52
53
# File 'lib/activeuuid/patches.rb', line 47

def uuid(*column_names)
  options = column_names.extract_options!
  column_names.each do |name|
    type = ActiveRecord::Base.connection.adapter_name.casecmp("postgresql").zero? ? "uuid" : "binary(16)"
    column(name, "#{type}#{' PRIMARY KEY' if options.delete(:primary_key)}", options)
  end
end