rollback to a specific migration, or multiple steps #373
Replies: 8 comments
-
Hey, thanks for the suggestion. This is a good idea, I would like to implement it for both $ dbmate migrate 20180124013241 # migrate up to and including "20180124013241"
$ dbmate rollback 20180124013241 # rollback any migrations greater than "20180124013241"
$ dbmate rollback n # rollback last n migrations (where n < 100 for easy parsing) Do you agree with the logic? Migrating forward |
Beta Was this translation helpful? Give feedback.
-
Right now dbmate appears to apply any missing migrations from the specified path regardless of their naming. For example if I add a new migration file that has an older timestamp than the one that is currently applied to the db it still attempts to apply it. I like this functionality! That begs the question. When you give examples above of "# migrate up to and including "20180124013241" what does that mean? Based on the default table order they are currently applied in the schema_migrations table? sorted alphabetically based on the local disk? EDIT: Added clarification in a new issue. |
Beta Was this translation helpful? Give feedback.
-
For a rollback, we would similarly only rollback migrations where you have the migration file on disk. |
Beta Was this translation helpful? Give feedback.
-
@amacneil is there any plans to deliver that stuff? |
Beta Was this translation helpful? Give feedback.
-
Not currently working on this feature, but PRs to implement it are welcome. |
Beta Was this translation helpful? Give feedback.
-
Would have been great to have this. |
Beta Was this translation helpful? Give feedback.
-
There are multiple PRs open that address this issue. |
Beta Was this translation helpful? Give feedback.
-
PR #438 satisfies this feature request. |
Beta Was this translation helpful? Give feedback.
-
Is it possible (or, could it be made possible) to 1) rollback more than one step at a time, and 2) (ideally) rollback to a specific named or timestamped migration?
Thank you, and great work!
Beta Was this translation helpful? Give feedback.
All reactions