Running ecto mix seed files in umbrella app
Several Ecto mixing tasks run at the top level of the umbrella application. Can seeds.exs be run at the top level of the umbrella? I would like to add an alias mix ecto.reset
to the umbrella. I can run the task drop
, create
and migrate
. But I cannot figure out how to run the seed file of each application.
I would like to understand how others are solving this problem.
+3
Steve pallen
source
to share
1 answer
A custom recursive mix task can work
defmodule Mix.Tasks.Ecto.Seed do
use Mix.Task
@recursive true
def run(_args) do
Mix.Tasks.Run.run(["priv/repo/seeds.exs"])
end
end
0
Mike buhot
source
to share