feat(EM-29): Define Per-Service Database Schema Migration Strategy with Flyway#51
Open
devin-ai-integration[bot] wants to merge 2 commits intofeat/microservices-migration-v2from
Conversation
…th Flyway - Create libs/ftgo-database-migration/ shared library with Flyway auto-configuration - Add FtgoFlywayAutoConfiguration with Spring Boot auto-config registration - Add FlywayMigrationProperties for configurable migration behavior - Add DatabaseNamingConvention utility for per-service database naming - Create initial V1 migration scripts for all services: - order-service: orders, order_line_items tables - consumer-service: consumers table - courier-service: courier, courier_actions tables - restaurant-service: restaurants, restaurant_menu_items tables - Add flyway-postgresql dependency and flyway bundles to version catalog - Add database migration strategy documentation in docs/database/ - Add unit tests for naming conventions and properties Co-Authored-By: Alex Baker <alexandercommander453@gmail.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
…nused custom interface and imports Co-Authored-By: Alex Baker <alexandercommander453@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
feat(EM-29): Define Per-Service Database Schema Migration Strategy with Flyway
Summary
Adds
libs/ftgo-database-migration/shared library providing Flyway auto-configuration for per-service databases, initial V1 migration scripts for all four services, Flyway dependency additions to the version catalog, and migration strategy documentation.Key changes:
flyway-postgresqllibrary andflyway-mysql-all/flyway-postgresql-allbundleslibs/ftgo-database-migration/: New module withFtgoFlywayAutoConfiguration, customFlywayMigrationProperties(ftgo.flyway.*),DatabaseNamingConventionutility, and aFlywayConfigurationCustomizerbean using Spring Boot's built-in interfaceorders,order_line_items), consumer-service (consumers), courier-service (courier,courier_actions), restaurant-service (restaurants,restaurant_menu_items)docs/database/migration-strategy.mdcovering naming conventions, Flyway config, schema details, and best practicesUpdates since last revision
FlywayConfigurationCustomizerfunctional interface with Spring Boot's built-inorg.springframework.boot.autoconfigure.flyway.FlywayConfigurationCustomizer. Theftgo.flyway.*properties now correctly propagate to Flyway'sFluentConfigurationvia Spring Boot's lifecycle.FlywayMigrationStrategybean (the@ConditionalOnPropertyonFtgoFlywayAutoConfigurationalready gates onftgo.flyway.enabled).Review & Testing Checklist for Human
ddl-auto: validate. In particular: thecouriertable is singular (no@Tableannotation onCourier.java— Hibernate's default naming strategy may produce a different name), andPaymentInformationis not annotated with@Embeddablewhich may cause mapping issues at startup.DatabaseNamingConventiondefines constants likeftgo_order_service_db, but existingapplication.ymlfiles point toftgo_order_service(no_dbsuffix). Confirm which convention is intended and reconcile.settings.gradle. The constraint says not to modify rootsettings.gradle, so this module exists on disk but isn't part of the Gradle build. CI does not compile or run the unit tests for this module. Confirm this is acceptable for now or if a separate composite build inclusion is needed.Recommended test plan:
libs/ftgo-database-migrationin a settings file and add it as a dependency to one service (e.g., order-service).ftgo_order_service_db).flyway_schema_historytable is createdNotes
application-flyway-defaults.ymlfile contains bothspring.flyway.*andftgo.flyway.*sections. Thespring.flyway.*section is redundant since theFlywayConfigurationCustomizerbean overrides those values. The profile is also never activated by default, so this file has no effect unless explicitly included.