Permalink
Browse files

Merge remote-tracking branch 'origin/master' into custom_type_migration

Conflicts:

    lib/dm-migrations/adapters/dm-do-adapter.rb

        Resolved by taking master and re-adding property.class.superclass
        lookup.
  • Loading branch information...
2 parents fce13b8 + 3758c71 commit b59e6b6b60df00df3cd1a3fc3ddff899a03a14cc @jpr5 jpr5 committed Sep 13, 2011
View
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
s.authors = ["Paul Sadauskas"]
- s.date = "2011-09-05"
+ s.date = "2011-09-09"
s.description = "DataMapper plugin for writing and speccing migrations"
s.email = "psadauskas [a] gmail [d] com"
s.extra_rdoc_files = [
@@ -195,16 +195,16 @@ def create_unique_index_statements(model)
# @api private
def property_schema_hash(property)
- primitive = property.primitive
- type_map = self.class.type_map
-
- schema = (type_map[property.class] || type_map[property.class.superclass] || type_map[primitive]).merge(:name => property.field)
+ dump_class = property.dump_class
+ type_map = self.class.type_map
+ schema = type_map[property.class] || type_map[property.class.superclass] || type_map[dump_class]
+ schema.merge!(:name => property.field)
schema_primitive = schema[:primitive]
- if primitive == String && schema_primitive != 'TEXT' && schema_primitive != 'CLOB' && schema_primitive != 'NVARCHAR'
+ if dump_class.equal?(String) && schema_primitive != 'TEXT' && schema_primitive != 'CLOB' && schema_primitive != 'NVARCHAR'
schema[:length] = property.length
- elsif primitive == BigDecimal || primitive == Float
+ elsif dump_class.equal?(BigDecimal) || dump_class.equal?(Float)
schema[:precision] = property.precision
schema[:scale] = property.scale
end
@@ -65,10 +65,8 @@ def without_notices
def property_schema_hash(property)
schema = super
- primitive = property.primitive
-
# Postgres does not support precision and scale for Float
- if primitive == Float
+ if property.kind_of?(Property::Float)
schema.delete(:precision)
schema.delete(:scale)
end
@@ -83,7 +83,7 @@ def build_type(type_class)
schema[:primitive] = type_class
else
type_map = @adapter.class.type_map
- primitive = type_class.respond_to?(:primitive) ? type_class.primitive : type_class
+ primitive = type_class.respond_to?(:dump_as) ? type_class.dump_as : type_class
options = (type_map[type_class] || type_map[primitive])
schema.update(type_class.options) if type_class.respond_to?(:options)

0 comments on commit b59e6b6

Please sign in to comment.