Module: DataMapper::Migrations::DataObjectsAdapter::ClassMethods

Defined in:
lib/dm-migrations/adapters/dm-do-adapter.rb

Instance Method Summary collapse

Instance Method Details

#type_mapHash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Default types for all data object based adapters.

Returns:

  • (Hash)

    default types for data objects adapters.



271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
# File 'lib/dm-migrations/adapters/dm-do-adapter.rb', line 271

def type_map
  length    = Property::String.length
  precision = Property::Numeric.precision
  scale     = Property::Decimal.scale

  {
    Property::Binary => { :primitive => 'BLOB'                                              },
    Object           => { :primitive => 'TEXT'                                              },
    Integer          => { :primitive => 'INTEGER'                                           },
    String           => { :primitive => 'VARCHAR', :length => length                        },
    Class            => { :primitive => 'VARCHAR', :length => length                        },
    BigDecimal       => { :primitive => 'DECIMAL', :precision => precision, :scale => scale },
    Float            => { :primitive => 'FLOAT',   :precision => precision                  },
    DateTime         => { :primitive => 'TIMESTAMP'                                         },
    Date             => { :primitive => 'DATE'                                              },
    Time             => { :primitive => 'TIMESTAMP'                                         },
    TrueClass        => { :primitive => 'BOOLEAN'                                           },
    Property::Text   => { :primitive => 'TEXT'                                              },
  }.freeze
end