datamapper / dm-migrations

DataMapper plugin for writing and speccing migrations
http://datamapper.org/
MIT License
66 stars 42 forks source link

Inherit DB field type from superclass (second try) #57

Closed tillsc closed 8 years ago

tillsc commented 8 years ago

Problem: All custom DataMapper::Properties (e.g. in dm-types) have database field types based upon their Ruby primitives. Especially Properties inheriting from DataMapper::Property::Text like DataMapper::Property::JSON have some problems with that behavior (since they will result in VARCARs instead of LOBs).

This commit adds logic to try to find a database field type based upon the superclasses of the (custom) property. Only if no superclass has a direkt mapping from property.class to field type the fallback to the Ruby primitive (returned by dump_as) will take place.

This PR follows a cleaner approach then #54

tpitale commented 8 years ago

This looks great. I'm going to try to get travis-ci running again. When I do, would you mind rebasing this against my fixes?

tpitale commented 8 years ago

@tillsc Mind rebasing from master? I wanna see this run through CI 😄

tillsc commented 8 years ago

crossing fingers....

tpitale commented 8 years ago

Woot! Ready to merge?

tillsc commented 8 years ago

Sure, why not? :)