Add option for migrate/down to apply/rollback specific migration #364
Replies: 10 comments
-
I think it is a must - not nice to have. |
Beta Was this translation helpful? Give feedback.
-
At the moment I do something like this:
to migrate down completely. It works, but it's slow like hell. Anyone any ideas how to make it faster? |
Beta Was this translation helpful? Give feedback.
-
Out of interest, why are you migrating down completely? If it's a test harness or something it would be a lot faster to drop and recreate the database. |
Beta Was this translation helpful? Give feedback.
-
@amacneil dbmate doesn't drop when there are open connections established to the database, but can migrate down/up. I would use drop I think, if I could. |
Beta Was this translation helpful? Give feedback.
-
Can you share why/when you are migrating down completely though? Is it at the start of your tests, or between each test, or something else? |
Beta Was this translation helpful? Give feedback.
-
Yes, in between test suites, to restore fresh database state. |
Beta Was this translation helpful? Give feedback.
-
Makes sense. I'm not sure whether you considered this, but in the past when running test suites I just drop and recreate the database once at the very start (before my test harness connects to the db), then run a command like |
Beta Was this translation helpful? Give feedback.
-
Yeah, that's what I ended up with at the moment. Also since I run db in docker container - stopping it and running anew might also be faster. |
Beta Was this translation helpful? Give feedback.
-
I have a PR to specify a specific migration to run: #434 |
Beta Was this translation helpful? Give feedback.
-
Would be nice if I could specify which migration to run. E.g.:
Beta Was this translation helpful? Give feedback.
All reactions