You have a custom mix task for your project. In that task, you want to interact with your project’s Ecto Repo.
When you do, you get the following error…
Import Mix.Ecto. It includes “Conveniences for writing Mix.Tasks in Ecto.”
Checkout the very readable source here.
The most relevant function for this scenario is
Here’s an example task that puts it to use.
Want More Examples?
If you’d like to see more examples of working with an Ecto Repo in your mix tasks, check out the elixir-ecto project’s mix tasks used for creating the existing tasks like