Module: WithUuid::Extensions::Migrations
- Defined in:
- lib/with_uuid/extensions/migrations.rb
Instance Method Summary collapse
Instance Method Details
#uuid(*column_names) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/with_uuid/extensions/migrations.rb', line 8 def uuid(*column_names) = column_names. column_names.each do |name| type = case(@base.adapter_name.downcase) when 'sqlserver' 'uniqueidentifier' when 'postgresql' 'uuid' else 'varchar(36)' end column(name, "#{type}#{' PRIMARY KEY' if options.delete(:primary_key)}", ) end end |
#uuid_fk(*column_names) ⇒ Object
23 24 25 |
# File 'lib/with_uuid/extensions/migrations.rb', line 23 def uuid_fk(*column_names) uuid( *column_names ) end |