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

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


1129
1130
1131
1132
1133
# File 'lib/dm-core/migrations.rb', line 1129

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)


1114
1115
1116
1117
1118
1119
# File 'lib/dm-core/migrations.rb', line 1114

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.



1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
# File 'lib/dm-core/migrations.rb', line 1086

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

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