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)


311
312
313
314
315
# File 'lib/dm-migrations/adapters/dm-oracle-adapter.rb', line 311

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)


296
297
298
299
300
301
# File 'lib/dm-migrations/adapters/dm-oracle-adapter.rb', line 296

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.



269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
# File 'lib/dm-migrations/adapters/dm-oracle-adapter.rb', line 269

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

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