-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Added knex.migrate.to and knex.migrate.before #513
base: master
Are you sure you want to change the base?
Conversation
Awesome! I'd be partial to passing an integer for the migration number. |
Maybe both? Check for the filename, fallback to the integer? |
I can do that, if you would like it? |
Yeah, go for it. |
Sorry for the long wait. I added a commit that adds support for both full file names and integers now. This means that:
Is equivalent to:
If you're happy with the result I can squash the commits? |
Can we have this, please? |
Hi, I started going through old pull requests and get them merged if possible or close otherwise if they are not going to be finished. @sebastianseilund do you think this is still relevant and useful feature to have? If so, conflicts needs to be fixed and documentation of the new feature added to index.html. |
Still should be synced up with the discussion in #617 as they require similar extensions to the underlying migration methods, but probably makes sense as a feature request still. Also still related to whether all of the migration work will move to https://github.com/knex/arctic as @bendrucker has indicated before or whether the current migration system is still open to extensions. |
i could definitely use this feature |
I took another route and created knex adapter and cli for unzug. It already handles "upto" and downto" logic. The only things to implement were support for batches and nice cli: knex-migrate |
anyone working on this? |
Closing due to inactivity, if someone likes to implement / fix this, please open another PR an link to this. |
@elhigu such a shame that this request got closed just as the other #617 we really need "up to" and "down to" methods, just as in https://github.com/tj/node-migrate#running-migrations with git backing all the version control - you really want to jump from version to version and not do separate up and downs in between. So such functionality seems highly required these days! Please reopen and finalize! |
@gpetrov Alive, but haven't used Knex in several years. You're welcome to finish up the work here :) |
@gpetrov It is implemented and should be working. I finally have some time and will check out the API part of it to see if there are issues with it. |
@gpetrov So this is more granular than what we have right now, which is moving single migration at a time? If that is the case, feel free to finish this PR, then it could be merged. |
Yes indeed @kibertoad we need more gradual from, to in sequence indeed, it is shame to loose the good code here, so I will see what I can do. But are you ready with the whole conversion to classes of Knex? Don't want to rewrite afterwards :) |
Like described in #506
Example usage in test:
I also cleaned up the migration integration tests a bit. Isolated the tests for each method more and made sure that they each clean up after themselves.
Questions:
knex.migrate.to('12345678_my_thing.js')
orknex.migrate.to('12345678')
? I prefer the first one, as there is no checks AFAICS whether the integer part is unique.Let me know if there is anything you want me to look at.