[ENHANCEMENT] Enable hot reload of the migration schemas #899
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Like for the plugin, we wanted to have the same hot reload system for the migration schemas.
We are doing this :
/migrate
is called, all script and schema are already loaded and so the user don't have to wait for this loading step.The idea here is to reuse the reloading system from the
schemas
package.The only problem with this idea, is that the loading of the migration schema is done in two steps:
mig.cuepart
So everytime a file
mig.cuepart
is changing, the step 2 must be triggered. That's why we are introducing acallback
function in the watcher. Like that we are able to trigger a last step once everyLoader
have been called.Finally we are introducing a new package
migrate
so we can reuse the migration logic in the CLI (for later). Like that we will have the same behaviour between the commandlint
andmigrate
. Meaning that you will have anonline
mode but it can also totally work offline.Signed-off-by: Augustin Husson husson.augustin@gmail.com