I’m working with an open source database. I’m trying to map it to classes with DataMapper, and later I’m going to make changes in a Model driven approximation instead of a Database driven one.
But first I would like to map the open source database in an exact way. This database is a PostgreSQL one and in some tables there are some fields with a character type.
How can I map character type in DataMapper? This type it’s not in its primitive types, nor in dm-types, nor in dm-types-legacy.
If it gives more information, actually I’m not writing the model by hand but I’m using dm-is-reflective, which automatically maps an existing database table. It gives me following error:
/var/lib/gems/1.9.1/gems/dm-is-reflective-1.0.0/lib/dm-is-reflective/is/adapters/data_objects_adapter.rb:141:in `reflective_lookup_primitive': bpchar not found for DataMapper::Adapters::PostgresAdapter (TypeError)
EDIT
It was a problem with dm-is-reflective and not with datamapper core, which can work well with char type as a String type with a length set. I answer with the solution to the problem.
godfat, the man working in
dm-is-reflectivequickly solved this issue 🙂 Many thanks to him!https://github.com/godfat/dm-is-reflective/issues/3#issuecomment-5726650