April 2019
Beginner to intermediate
244 pages
6h 34m
English
Sometimes you want to undo the changes you made in a migration. This happens frequently in development—you’ll often change your mind about what your table should look like so it’s common to create a migration, roll it back, make some changes and run it again. But it can also happen when your app is in production as well, when you have one of those dreaded “oops” moments.
Ecto provides the ecto.rollback mix task to roll back one or more migrations. Let’s try that out now:
| | $ mix ecto.rollback |
| | 06:17:40.823 [info] == Running |
| | MusicDB.Repo.Migrations.AddCompositionsTable.change/0 backward |
| | |
| | 06:17:40.824 [info] drop table compositions |
| | |
| | 06:17:40.831 [info] == Migrated in 0.0s |
The output ...
Read now
Unlock full access