-
Notifications
You must be signed in to change notification settings - Fork 277
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
feat: add RollbackAll to roll back all migrations #303
base: main
Are you sure you want to change the base?
Conversation
@amacneil is there anything blocking this PR that I can do? Thanks! |
I opened #438 which allows a syntax for specifying a range of migration. That would work well combined with a command like this. But not sure if we should have a new command or have a |
I think I put more thoughts in this comment. |
Just wondering, @gnuletik, what is the semantic difference between Is there an expectation that |
@dossy I totally agree with you. Rolling back all migrations should leave the database in the same state as a new database if all up/down migrations file are clean. If you missed something in your down migration, then applying all up migrations will fail. This is the use case I'm trying to cover with this command. Having a rollback --all command would allow easy testing (e.g. in CI) of the down and up migrations. |
😲 🤯 Okay, that's a super clever use case for You do a Well, I'm sold :) on the idea! I'm sorry I never saw #292 and your previous explanation in this comment -- thanks for repeating it here. We'll need to add the |
Testing all down-migrations in CI is exactly the use-case which lead me to this thread, I'd love to see this added! I actually did try |
In case it helps anyone here's my intermediate solution: for i in db/migrations/*
do
if test -f "$i"
then
dbmate down
fi
done; This runs as a step in my CI. And it did catch one error I made in one down-migration! |
No description provided.