brainlid
New "mix release" and DB migrations
I’ve been playing with the new Elixir 1.9.0-dev branch to try out the new “releases”. Everything is working but the piece left unsolved is running DB migrations and seeds.
Previously with Distillery I did those as release tasks. I haven’t found any examples or recommended approaches to this yet.
Looking for guidance or core-team information on what the expected or recommended approach should be.
Most Liked
jola
I asked that question on the mailing list and the short answer is, basically the same way you do with Distillery. Release tasks in Distillery are just custom commands, and what the guide for migrations does is a custom command that evals a function. You can do that in 1.9 releases as well. So it’s the exact same thing, except instead of
app/bin/hello migrate
you run
app/bin/hello eval "Hello.ReleaseTasks.migrate"
josevalim
We are also adding new functions to Ecto.SQL to abstract the bureaucracy of starting new applications and repositories to run migrations in releases: Add Ecto.Migrator.with_repo/2 to start/stop apps for migrations by josevalim · Pull Request #113 · elixir-ecto/ecto_sql · GitHub
This code was already inside of Ecto.SQL, we are just making it public.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance








