Skip to content
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

[ENHANCEMENT] Enable hot reload of the migration schemas #899

Merged
merged 3 commits into from
Jan 4, 2023

Conversation

Nexucis
Copy link
Member

@Nexucis Nexucis commented Jan 2, 2023

Like for the plugin, we wanted to have the same hot reload system for the migration schemas.
We are doing this :

  • for consistency regarding the way we are loading the plugin
  • because reading file from the FS can take some time, it's interesting to have them already loaded in the memory. Like that when the endpoint /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:

  1. Load every file mig.cuepart
  2. Once everything is loaded, use these values to complete the final migration schema.

So everytime a file mig.cuepart is changing, the step 2 must be triggered. That's why we are introducing a callback function in the watcher. Like that we are able to trigger a last step once every Loader 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 command lint and migrate. Meaning that you will have an online mode but it can also totally work offline.

Signed-off-by: Augustin Husson husson.augustin@gmail.com

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
@Nexucis Nexucis force-pushed the nexucis/migration-hot-reload branch 2 times, most recently from b4567cd to 7deff21 Compare January 3, 2023 09:28
@Nexucis Nexucis marked this pull request as draft January 3, 2023 09:28
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
@Nexucis Nexucis force-pushed the nexucis/migration-hot-reload branch from 7deff21 to 796f6ed Compare January 3, 2023 09:37
@Nexucis Nexucis requested a review from AntoineThebaud January 3, 2023 10:15
@Nexucis Nexucis marked this pull request as ready for review January 3, 2023 10:16
@Nexucis Nexucis force-pushed the nexucis/migration-hot-reload branch 2 times, most recently from faf6aff to b32a8b0 Compare January 3, 2023 14:01
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
@Nexucis Nexucis force-pushed the nexucis/migration-hot-reload branch from b32a8b0 to f072f28 Compare January 3, 2023 14:08
@Nexucis Nexucis merged commit e1c446c into main Jan 4, 2023
@Nexucis Nexucis deleted the nexucis/migration-hot-reload branch January 4, 2023 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants