Is it possible to use Ecto without a Repo. I want to use changesets/schemas without Postgres or a datastore. In my Phoenix app I commented out my Repo code and also updated my config/config.exs to
config :my_app, ecto_repos: []
But that’s leading to this warning:
warning: could not find Ecto repos in any of the apps: [:my_app].
You can avoid this warning by passing the -r flag or by setting the
repositories managed by those applications in your config/config.exs:
config :my_app, ecto_repos: [...]
Hm, I have the line in application.ex commented out that adds a supervisor for it. I seem to only be getting that warning when I run tests. When I run a phx.server the warning isn’t showing up. When you run tests are you not seeing any warnings?
No. You might have some references to Repo in your test helpers and/or config.
What I typically do is create the project with the --no-ecto flag and then add ecto in as a dependency. That way it doesn’t create a lot of the ecto/repo boiler plate.
As far as I remember, that warning is only printed by the ecto mix tasks like ecto.migrate and friends. It seems you shouldn’t run those tasks if you don’t want to use ecto for managing the database. You probably have some aliases to the tasks in mix.exs or happen to run them by accident in some other way.