Problems using Rom with a legacy database

I have a new Hanami 2 application and have configured Rom according to the “Getting Started” guidelines. I have access to my (legacy) database now, so this is working.

Now, I want to change a few things in my schema so that it is easier to work with it. Some columns in the database are in uppercase and I want to access them in lowercase. I tried to “fix” this with a custom entity and overwriting the method_missing method but this feels a little bit clunky. Is there a way I can configure the schema to automatically lower case the column names?

Have you looked into using a custom mapper for this?

You can override default dataset via dataset do ... end in relation classes and do project there. This will work for reading. Then for writing you can use changesets to upcase. Currently there’s no way to have automatic bi-directional mapping because it’s a very rare requirement and nobody had the time to implement it.

Why not using identifier_mangling.rb?

rom_config.gateways[:default].connection.extension :identifier_mangling
rom_config.gateways[:default].connection.identifier_output_method = :downcase