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
Support multiple migration directories #2690
Comments
@elhigu This is something that my current project could use so I could work on a PR for this if you would approve such change :) |
Maybe related issue: #607 not exactly the same I think. I suppose what you are proposing is doable and pretty easy; just go through all migration directories, collect filenames, sort them and run migrations as currently (and store only migration filename). Writing tests for this is most difficult, where you should move migrations from one directory to another and add new migration directory on the fly etc. Just to be sure. This change won't allow to lose any of old migration files? |
Yup, tests gonna take a while :). |
This sounds good to me, I don't have any problems for accepting PR for this. So @kibertoad go ahead if you are up to implement this 👍 |
@elhigu Started working on it, one question I have - there was a rather strange decision to put Migrator class inside migrate/index.js which makes finding it less trivial than it should be. Would you mind if I extracted it into migrator.js? |
Yeah, that should be just fine. Is this feature now ready and it works backwards compatible way? |
Its merged now :) |
Implemented in #2735 |
Is there a documentation on how to use this feature ? I want to create multiple migration directories and how to use make command to specify which directory to use and similar related documentation ? |
If you need just one directory that changes, then you might need to use environment variables in knexfile.js to pass directory name there. If multiple directories are listed in the knexfile, all of then are used. |
Feature discussion / request
There are two clear use-cases when having multiple migration directories is beneficial:
In order to achieve this goal, it should be possible to pass an array of paths as 'directory' parameter in Migrations API.
Migration location within provided list should be interchangeable as far as check for missing migrations is concerned, so that migration could e. g. be moved from "latest" to "2017" at any given moment.
The text was updated successfully, but these errors were encountered: