-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Manual Ecto migrations addon #44
Comments
@nimblehq/elixir-guild Do you think it worth to add this Addon into the template? |
@andyduong1920 I believe this now becomes the There is a specific config that we've added into one of the project. Because we're trying to avoid the data migration on the test. With the config: defp aliases() do
[
"ecto.migrate_all": ["ecto.migrate --migrations-path=priv/repo/migrations --migrations-path=priv/repo/manual_migrations"],
"ecto.setup": ["ecto.create", "ecto.migrate_all", "run priv/repo/seeds.exs"],
test: ["ecto.create --quiet", "ecto.migrate --quiet", "test"] This works perfectly, when running So we did: defp aliases() do
[
"ecto.setup": ["ecto.create", &migrate/1, "run priv/repo/seeds.exs"],
test: ["ecto.create --quiet", &migrate/1, "test"],
...
]
end
defp migrate(_) do
if Mix.env() == :test do
Mix.Task.run("ecto.migrate", ["--quiet"])
else
Mix.Task.run("ecto.migrate", [
"--migrations-path=priv/repo/migrations",
"--migrations-path=priv/repo/data_migrations"
])
end
end (We did remove Not sure if anyone facing the same issue. I'll just leave the snippet here in case we might want to add it to the template. |
Not really @rosle |
@andyduong1920 got it. But we also not have the |
That is correct @rosle :) |
I have opened a PR for the |
Following the https://dashbit.co/blog/automatic-and-manual-ecto-migrations it nice to have the
manual_migration
pre-setting1/ Adding migrate_manual to the https://github.com/nimblehq/elixir-templates/blob/develop/priv/templates/nimble.phx.gen.template/lib/otp_app/release_tasks.ex.eex
2/ Adjust aliases in mix.ex file
The text was updated successfully, but these errors were encountered: