Module: DataMapper::Adapters::DataObjectsAdapter::Migration::ClassMethods

Included in:
DataMapper::Adapters::DataObjectsAdapter
Defined in:
lib/gems/dm-core-0.9.9/lib/dm-core/adapters/data_objects_adapter.rb

Instance Method Summary collapse

Instance Method Details

#type_mapDataMapper::TypeMap

Default TypeMap for all data object based adapters.

TODO: move to dm-more/dm-migrations

Returns:



603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
# File 'lib/gems/dm-core-0.9.9/lib/dm-core/adapters/data_objects_adapter.rb', line 603

def type_map
  @type_map ||= TypeMap.new(super) do |tm|
    tm.map(Integer).to('INT')
    tm.map(String).to('VARCHAR').with(:size => Property::DEFAULT_LENGTH)
    tm.map(Class).to('VARCHAR').with(:size => Property::DEFAULT_LENGTH)
    tm.map(DM::Discriminator).to('VARCHAR').with(:size => Property::DEFAULT_LENGTH)
    tm.map(BigDecimal).to('DECIMAL').with(:precision => Property::DEFAULT_PRECISION, :scale => Property::DEFAULT_SCALE_BIGDECIMAL)
    tm.map(Float).to('FLOAT').with(:precision => Property::DEFAULT_PRECISION)
    tm.map(DateTime).to('DATETIME')
    tm.map(Date).to('DATE')
    tm.map(Time).to('TIMESTAMP')
    tm.map(TrueClass).to('BOOLEAN')
    tm.map(DM::Object).to('TEXT')
    tm.map(DM::Text).to('TEXT')
  end
end