-
Notifications
You must be signed in to change notification settings - Fork 65
Decentralized migration scan package #705
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
Decentralized migration scan package #705
Conversation
This reverts commit f78c6a0.
…lamingock#701) * issue/flamingock#700 Allow writeConcern to be configured as a number - enables configuring Mongock with numeric writeConcern values (representing W1, W2, etc.). - previously, only "majority" or "tag set name" were supported. * issue/flamingock#700 Allow writeConcern to be configured as a number - added simple test --------- Co-authored-by: Vít Hanousek <[email protected]>
|
I can't provide a example project in example projects until you guys merge the code |
|
Waiting for your feedback |
|
There is another feature that needs to be released for this to work well |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @DanielSchiavo,
First of all, apologies for the delay in getting back to you — we’ve been working hard on our upcoming release, which will introduce many new features and mark a significant step forward in Mongock’s evolution.
Regarding your PR, thank you very much for the contribution — we really appreciate your effort. We believe this is a valuable improvement and are happy to move forward with merging it. That said, we have a few suggestions that might simplify the design and increase flexibility moving forward.
Although the current approach works, it might be more complex than necessary. What do you think about merging the concepts of Config and ScanPackage, and generalizing it to support additional properties in the future?
Here’s our proposed approach:
-
Standalone runner
Introduce aMongockModuleConfiginterface with a method that returns a list of packages. The builder could then accept multipleMongockModuleConfiginstances, offering a clean and extensible solution. -
Spring Boot integration
Instead of using a custom annotation, it may be more user-friendly and consistent with the standalone approach to allow users to register any number ofMongockModuleConfigbeans. If I’m not mistaken (please confirm), Spring can inject a list of beans of the same type — we could leverage that to collect all registered configs into the builder.
Please let us know what you think. Once we agree on the best approach, I’m happy to assist with the final review and get this merged.
Thanks again!
|
I'm glad you liked it @dieppa . We can do it this way, I think it's a wise choice. |
Removed files and code previously featured in mongock standalone Added new role in core runner builder, named ModuleConfigurationProvider Modified RunnerBuilder to incorporate ModuleConfigurationProvider Added new attribute in MongockConfiguration named mongockModules, and respective getter and setter
|
Hello @DanielSchiavo, I am confused this is ready to review or you haven't got the change to update it as we discuss it? Let us know and we review it |
Issue reference
https://github.com/mongock/mongock/issues/704
Documentation PR reference
There are 2 commits
flamingock/mongock-docs#44
Description and context
This feature introduces multi-module support to Mongock, enabling modular projects to define and register their own migration packages independently.
Traditionally, Mongock required all migration packages to be configured centrally during builder setup. This approach can be limiting in large modular applications where each module should be able to manage its own database changes.
With this contribution:
Spring Boot modules can now annotate their configuration classes using @MongockScanPackage, and with this annotation, the package will be automatically added to the migration scan package.
For standalone applications, each module can implement a new MongockModuleConfig interface to programmatically register its own migration packages via builder.
This change improves decoupling, scalability, and maintainability in complex systems, especially microservices or monolithic applications split by modules.
Benefits
✅ Decentralized configuration of migration packages.
✅ Enables each module to independently define its migrations.
✅ Improves modularity and separation of concerns.
✅ Enhances flexibility for both Spring and Standalone runners.
✅ Maintains backward compatibility for centralized configuration.
✅ Provides a clean pattern for module-level migrations, both with annotations and builder-style setup.
Possible Drawbacks
I can't think of any
Checklist