Search code examples
elixirphoenix-frameworkecto

How to rollback a specific ecto migration?


What is Phoenix's equivalent of Rails'?

rake db:migrate:down VERSION=20100905201547

Solution

  • Currently there is no way to accomplish this.

    We can rollback all the way to a specific migration using:

    mix ecto.rollback -v 20080906120000
    

    or

    mix ecto.rollback --to 20080906120000
    

    But with both syntaxes all the migrations between the current one and the specified one will be rolled back as well.

    A user in the Elixir Forum also mentioned that creating a new migration that will undo what needs to be undone will be a good way to keep history accessible.