Module: DataMapper::Migrations::PostgresAdapter

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

Instance Method Summary collapse

Instance Method Details

#property_schema_hash(property) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/dm-postgres-types.rb', line 22

def property_schema_hash(property)
  schema = super

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

  schema
end