Closed tillsc closed 8 years ago
I'm sorry for the old school style while
loops. But I tried not to change the class signatures.
@tillsc Would love to merge this. Can you take a look when you get a chance?
I did a whole new approach in #57. I decided to make a new branch to keep the history a bit cleaner. The failing specs I added in this approach where ported to the new approach. Everything else is new (and tested with mysql and postgres).
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.