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

Defined in:
lib/dm-core/migrations.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.



296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
# File 'lib/dm-core/migrations.rb', line 296

def type_map
  length    = Property::DEFAULT_LENGTH
  precision = Property::DEFAULT_PRECISION
  scale     = Property::DEFAULT_SCALE_BIGDECIMAL

  @type_map ||= {
    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'                                           },
    Types::Object => { :primitive => 'TEXT'                                              },
    Types::Text   => { :primitive => 'TEXT'                                              },
  }.freeze
end