Module: ActiveRecord::PropertybaseId::Patches::Migrations

Defined in:
lib/activerecord/propertybase_id/patches.rb

Instance Method Summary collapse

Instance Method Details

#propertybase_id(*column_names) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/activerecord/propertybase_id/patches.rb', line 5

def propertybase_id(*column_names)
  options = column_names.extract_options!
  column_names.each do |name|
    type = "char(#{::PropertybaseId.max_length})"
    primary_key = options.delete(:primary_key) || name.to_s == "id"
    column(name, "#{type}#{' PRIMARY KEY' if primary_key}", options)
  end
end