Module: DataMapper::Migrations::OracleAdapter::ClassMethods

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

Instance Method Summary collapse

Instance Method Details

#auto_migrate_reset_sequences(value = :not_specified) ⇒ Symbol

Set if sequences will or will not be reset during auto_migrate!

Parameters:

  • reset (TrueClass, FalseClass)

    sequences? do not specify parameter to return current value

Returns:

  • (Symbol)

    current value of auto_migrate_reset_sequences option (default value is true)

Raises:

  • (ArgumentError)


322
323
324
325
326
# File 'lib/dm-migrations/adapters/dm-oracle-adapter.rb', line 322

def auto_migrate_reset_sequences(value = :not_specified)
  return @auto_migrate_reset_sequences.nil? ? true : @auto_migrate_reset_sequences if value == :not_specified
  raise ArgumentError unless [true, false].include?(value)
  @auto_migrate_reset_sequences = value
end

#auto_migrate_with(value = :not_specified) ⇒ Symbol

Use table truncate or delete for auto_migrate! to speed up test execution

Parameters:

  • :truncate, (Symbol)

    :delete or :drop_and_create (or nil) do not specify parameter to return current value

Returns:

  • (Symbol)

    current value of auto_migrate_with option (nil returned for :drop_and_create)

Raises:

  • (ArgumentError)


307
308
309
310
311
312
# File 'lib/dm-migrations/adapters/dm-oracle-adapter.rb', line 307

def auto_migrate_with(value = :not_specified)
  return @auto_migrate_with if value == :not_specified
  value = nil if value == :drop_and_create
  raise ArgumentError unless [nil, :truncate, :delete].include?(value)
  @auto_migrate_with = value
end

#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.

Types for Oracle databases.

Returns:

  • (Hash)

    types for Oracle databases.



280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
# File 'lib/dm-migrations/adapters/dm-oracle-adapter.rb', line 280

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

  {
    Integer        => { :primitive => 'NUMBER',   :precision => precision, :scale => 0   },
    String         => { :primitive => 'VARCHAR2', :length => length                      },
    Class          => { :primitive => 'VARCHAR2', :length => length                      },
    BigDecimal     => { :primitive => 'NUMBER',   :precision => precision, :scale => nil },
    Float          => { :primitive => 'BINARY_FLOAT',                                    },
    DateTime       => { :primitive => 'DATE'                                             },
    Date           => { :primitive => 'DATE'                                             },
    Time           => { :primitive => 'DATE'                                             },
    TrueClass      => { :primitive => 'NUMBER',  :precision => 1, :scale => 0            },
    Property::Text => { :primitive => 'CLOB'                                             },
  }.freeze
end