So, in another thread I mentioned I had found some issues so I figure I should put them in individual threads so they don’t get mixed up.
Just today I found this problem.
I’ll just present it and see what people think.
I am using the dry-container library to set up all of my applications config, services etc. This includes ROM.
In the ROM config I specify a relation, with an inferred schema e.g;
rom = ROM.container(:sql, url) do |conf| conf.relation(:accounts) do schema(infer: true) do end end end
When I attempt to migrate a clean database this causes the following error to be thrown up (but the migration works)
[ROM::Relation[Accounts]] failed to infer schema. Make sure tables exist before ROM container is set up. This may also happen when your migration tasks load ROM container, which is not needed for migrations as only the connection is required (PG::UndefinedTable: ERROR: relation "accounts" does not exist LINE 1: ..."."attnum" > 0) AND ("pg_class"."oid" = CAST(CAST('"accounts... ^ )
So, is there any way of making these things go away? Right now it means I would need to create a different ROM config for migrations than for general usage which feels awkward.
I found another problem earlier with schema inferring but I need to try and replicate it.