Module: DataMapper::Migrations::PostgresAdapter

Defined in:
lib/dm-pg-types.rb

Instance Method Summary collapse

Instance Method Details

#property_schema_hash(property) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/dm-pg-types.rb', line 16

def property_schema_hash(property)
  schema = super

  if property.kind_of?(Property::DecimalArray)
    schema[:primitive] = "#{schema[:primitive]}(#{property.precision},#{property.scale})[]"
    schema[:precision] = schema[:scale] = nil
  elsif property.kind_of?(Property::StringArray)
    schema[:primitive] = "#{schema[:primitive]}(#{property.length})[]"
    schema[:length] = nil
  end

  schema
end