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.



260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
# File 'lib/dm-migrations/adapters/dm-do-adapter.rb', line 260

def type_map
  length    = Property::String::DEFAULT_LENGTH
  precision = Property::Numeric::DEFAULT_PRECISION
  scale     = Property::Decimal::DEFAULT_SCALE

  @type_map ||= {
    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