I have a Phoenix Ecto app that has an additional GenServer in the Application supervisor.
The GenServer process will access the database when spawned.
I had the following issue:
** (RuntimeError) could not lookup Ecto repo MyApp.Repo because it was not started or it does not exist
This is due to the Ecto repository not being created when the GenServer starts.
The fix is simple, we need to automatically start the Repo when needed.
This is done by editing test_helper.ex
and changing :manual
to :auto
in
this line:
Ecto.Adapters.SQL.Sandbox.mode(MyApp.Repo, :auto)