I've got a legacy database that I'm trying to pull into Ecto. In it there's an orders
table which has an order_status_id
column. order_status_id
maps to a set of constants in the legacy system.
I'd like to have the MyApp.Order
struct contain an order_status
field, which has a custom type that converts the integer IDs to meaningful atoms. I've got the custom type working, but I can't figure out how to map a field named order_status
to a column named order_status_id
.
The legacy system is still online and using the database, so changing the DB schema is not an option. Is there any way to get this working?