charlesjavelona
Rollback migration in gigalixir?
Has anyone tried rolling back ecto migration in gigalixir.
Locally, it’s mix ecto.rollback. In gigalixir it’s gigalixir ps:migrate
There doesn’t seem to have a rollback option. What options do I have?
Most Liked
Gigalixir
That sounds like a good feature request. We will add it to our list.
Here’s how to rollback ALL migrations: https://gigalixir.readthedocs.io/en/latest/database.html#how-to-reset-the-database
Basically:
- Drop into a remote console with
gigalixir ps:remote_console - Run
Ecto.Migrator.run(MyApp.Repo, Application.app_dir(:my_app, "priv/repo/migrations"), :down, [all: true])
I believe you can rollback a single item with:
Ecto.Migrator.run(MyApp.Repo, Application.app_dir(:my_app, "priv/repo/migrations"), :down, [step: 1])
Be sure to use your app name from mix.exs instead of MyApp and your app atom instead of :my_app.
It appears there is now a #down for Ecto.Migrator that might be useful.
More info here: Ecto.Migrator — Ecto SQL v3.14.0
thomas.fortes
Not a gigalixir user but it looks like ps:migrate is just a helper, maybe you could use the strategy used to deploy (and rollback) migrations in releases.
andreaseriksson
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









