Skip to content

Dev#5844

Merged
KouShenhai merged 3 commits intomasterfrom
dev
Mar 11, 2026
Merged

Dev#5844
KouShenhai merged 3 commits intomasterfrom
dev

Conversation

@KouShenhai
Copy link
Owner

@KouShenhai KouShenhai commented Mar 11, 2026

Summary by Sourcery

将数据库变更管理从 Liquibase 迁移到 Flyway,覆盖所有管理服务,并更新相关的 SQL 迁移脚本和配置。

增强内容:

  • 在根模块和管理端基础设施 Maven 模块中,将 Liquibase 依赖替换为 Flyway(包括 PostgreSQL 支持)。
  • 在管理服务和独立管理服务中重新配置 Spring Boot 属性,使其使用 Flyway 而非 Liquibase 来执行数据库迁移。
  • 将现有用于国际化菜单设置的 Liquibase 变更日志 SQL 脚本转换为与 Flyway 兼容的迁移脚本,适用于标准管理服务和独立管理服务。
  • 从 Nacos SQL 模式中清理已废弃的 Liquibase 变更日志元数据表,并删除 Liquibase 变更日志 XML 文件。

文档:

  • 新增文档,说明在项目中使用 Flyway 的方式及其配置。
Original summary in English

Summary by Sourcery

Migrate database change management from Liquibase to Flyway across the admin services and update related SQL migrations and configuration.

Enhancements:

  • Replace Liquibase dependencies with Flyway (including PostgreSQL support) in the root and admin infrastructure Maven modules.
  • Reconfigure Spring Boot properties in admin and standalone admin services to use Flyway for database migrations instead of Liquibase.
  • Convert existing Liquibase changelog SQL scripts for internationalized menu setup into Flyway-compatible migration scripts for both standard and standalone admin services.
  • Clean up obsolete Liquibase changelog metadata tables from the Nacos SQL schema and remove Liquibase changelog XML files.

Documentation:

  • Add documentation describing Flyway usage and configuration in the project.

Summary by CodeRabbit

  • Documentation

    • Added comprehensive Flyway configuration guide including Spring Boot integration steps, SQL migration script naming conventions, configuration parameters, baseline setup, validation options, and detailed comparison with alternative migration platforms.
  • Chores

    • Updated database migration configuration and dependencies across services; removed legacy migration tracking schemas and metadata.

@netlify
Copy link

netlify bot commented Mar 11, 2026

Deploy Preview for kcloud-platform-iot ready!

Name Link
🔨 Latest commit 81dd03c
🔍 Latest deploy log https://app.netlify.com/projects/kcloud-platform-iot/deploys/69b0e88a3121390008ac42c8
😎 Deploy Preview https://deploy-preview-5844--kcloud-platform-iot.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@sourcery-ai
Copy link

sourcery-ai bot commented Mar 11, 2026

审查者指南

此 PR 将在管理服务中用于数据库迁移的 Liquibase 替换为 Flyway,相应更新配置和依赖,清理遗留的 Liquibase 元数据结构,并为常规版和独立版管理端部署中的国际化(i18n)菜单表引入基于 Flyway 的迁移脚本。

使用 Flyway 迁移的 Spring Boot 启动时序图

sequenceDiagram
  participant SpringBoot as SpringBootAdminApp
  participant Flyway as FlywayAutoConfiguration
  participant DB as PostgreSQLAdminDatabase

  SpringBoot->>SpringBoot: loadApplicationContext
  SpringBoot->>Flyway: createFlywayBeans
  Flyway->>DB: connect
  Flyway->>DB: checkFlywaySchemaHistory
  Flyway->>DB: scanAppliedMigrations
  Flyway->>SpringBoot: readProperties(locations,baselineOnMigrate,baselineVersion,validateOnMigrate)
  Flyway->>DB: scanPendingMigrations(classpath_db_migration)
  Flyway->>DB: applyMigration(V1_202603092010__create_i18n_menu)
  Flyway->>DB: applyMigration(V2_202603092010__insert_i18n_menu)
  Flyway->>DB: applyMigration(V3_202603092010__update_menu)
  Flyway-->>SpringBoot: migrationsComplete
  SpringBoot-->>SpringBoot: finishStartup
Loading

sys_i18n_menu 及相关菜单数据的 ER 图

erDiagram
  SYS_MENU {
    bigint id PK
    varchar name
    varchar path
  }

  SYS_I18N_MENU {
    bigint id PK
    bigint creator
    bigint editor
    timestamp create_time
    timestamp update_time
    smallint del_flag
    int version
    bigint tenant_id
    bigint dept_id
    varchar code
    varchar menu
  }

  SYS_MENU ||--o{ SYS_I18N_MENU : localized_by
Loading

文件级变更

变更 详情 文件
在整个项目和 admin 基础设施模块中,将数据库迁移框架从 Liquibase 切换到 Flyway。
  • 在父 POM 的 dependencyManagement 部分,用 flyway-core 和 flyway-database-postgresql 替换 liquibase-core 依赖,并引入新的 flyway.version 属性。
  • 更新 laokou-admin-infrastructure 模块的 POM,使其依赖 Flyway(flyway-core、flyway-database-postgresql、spring-boot-flyway)而不是 Liquibase(liquibase-core、spring-boot-liquibase)。
pom.xml
laokou-service/laokou-admin/laokou-admin-infrastructure/pom.xml
将 admin 服务中 Spring Boot 的数据库迁移设置从 Liquibase 重新配置为 Flyway。
  • 在 admin 服务的 application.yml 中,用 spring.flyway 配置替换 spring.liquibase,指定 locations、baseline-on-migrate、baseline-version 和 validate-on-migrate。
  • 在独立版 admin 服务的 application.yml 中应用相同的 Flyway 配置切换。
laokou-service/laokou-admin/laokou-admin-start/src/main/resources/application.yml
laokou-service/laokou-standalone/laokou-standalone-admin/laokou-standalone-admin-start/src/main/resources/application.yml
将现有用于 i18n 菜单的 Liquibase SQL changelog 脚本转换为 admin 服务的 Flyway 迁移脚本。
  • 将 SQL 文件从 db/changelog/sql 移动到 db/migration,并重命名为 Flyway 版本化文件名(V1_...、V2_...、V3_...)。
  • 从 SQL 脚本中删除 Liquibase 特有的格式化注释(例如 “liquibase formatted sql” 和 “changeset” 头部),仅保留由 Flyway 执行的纯 SQL。
laokou-service/laokou-admin/laokou-admin-start/src/main/resources/db/changelog/sql/000001_create_i18n_menu.sql
laokou-service/laokou-admin/laokou-admin-start/src/main/resources/db/changelog/sql/000002_insert_i18n_menu.sql
laokou-service/laokou-admin/laokou-admin-start/src/main/resources/db/changelog/sql/000003_update_menu.sql
laokou-service/laokou-admin/laokou-admin-start/src/main/resources/db/migration/V1_202603092010__create_i18n_menu.sql
laokou-service/laokou-admin/laokou-admin-start/src/main/resources/db/migration/V2_202603092010__insert_i18n_menu.sql
laokou-service/laokou-admin/laokou-admin-start/src/main/resources/db/migration/V3_202603092010__update_menu.sql
为独立版 admin 服务中的 i18n 菜单引入等价的 Flyway 迁移脚本。
  • 新增 Flyway V1 迁移,用于创建 sys_i18n_menu 表(包含表结构、注释、索引和主键)。
  • 新增 Flyway V2 迁移,用于向 sys_i18n_menu 插入种子数据行。
  • 新增 Flyway V3 迁移,用于更新现有的 sys_menu 条目,使其指向 i18n 菜单路径。
laokou-service/laokou-standalone/laokou-standalone-admin/laokou-standalone-admin-start/src/main/resources/db/migration/V1_202603092010__create_i18n_menu.sql
laokou-service/laokou-standalone/laokou-standalone-admin/laokou-standalone-admin-start/src/main/resources/db/migration/V2_202603092010__insert_i18n_menu.sql
laokou-service/laokou-standalone/laokou-standalone-admin/laokou-standalone-admin-start/src/main/resources/db/migration/V3_202603092010__update_menu.sql
从代码库中移除 Liquibase 特有的数据库对象和 changelog 描述文件。
  • 在 Nacos SQL 初始化脚本中,删除创建 Liquibase 元数据表(databasechangelog 和 databasechangeloglock)的语句。
  • 删除 admin 服务和独立版 admin 服务的 Liquibase master changelog XML 文件。
doc/db/4.0.0/kcloud_platform_nacos.sql
laokou-service/laokou-admin/laokou-admin-start/src/main/resources/db/changelog/db.changelog-master.xml
laokou-service/laokou-standalone/laokou-standalone-admin/laokou-standalone-admin-start/src/main/resources/db/changelog/db.changelog-master.xml

提示与命令

与 Sourcery 交互

  • 触发新的代码审查: 在 Pull Request 中评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的审查评论。
  • 从审查评论生成 GitHub Issue: 在回复审查评论时请求 Sourcery 根据该评论创建 Issue。你也可以在审查评论下回复 @sourcery-ai issue 来从该评论生成一个 Issue。
  • 生成 Pull Request 标题: 在 Pull Request 标题中任意位置写上 @sourcery-ai,即可随时生成标题。你也可以在 Pull Request 中评论 @sourcery-ai title 来(重新)生成标题。
  • 生成 Pull Request 摘要: 在 Pull Request 正文任意位置写上 @sourcery-ai summary,即可在对应位置随时生成 PR 摘要。你也可以在 Pull Request 中评论 @sourcery-ai summary 来(重新)生成摘要。
  • 生成审查者指南: 在 Pull Request 中评论 @sourcery-ai guide,即可随时(重新)生成审查者指南。
  • 一次性解决所有 Sourcery 评论: 在 Pull Request 中评论 @sourcery-ai resolve,将所有 Sourcery 评论标记为已解决。如果你已经处理完所有评论且不希望再看到它们,这会非常有用。
  • 清除所有 Sourcery 审查: 在 Pull Request 中评论 @sourcery-ai dismiss,以清除所有现有的 Sourcery 审查。特别适用于你想从头开始新的审查时——别忘了再评论 @sourcery-ai review 来触发新一轮审查!

自定义你的使用体验

访问你的 控制台 以:

  • 启用或禁用审查功能,例如 Sourcery 自动生成的 Pull Request 摘要、审查者指南等。
  • 更改审查语言。
  • 添加、移除或编辑自定义审查指令。
  • 调整其他审查设置。

获取帮助

Original review guide in English

Reviewer's Guide

This PR replaces Liquibase with Flyway for database migrations in the admin services, updates configuration and dependencies accordingly, cleans up legacy Liquibase metadata structures, and introduces Flyway-based migration scripts for the internationalization (i18n) menu tables in both the regular and standalone admin deployments.

Sequence diagram for Spring Boot startup with Flyway migrations

sequenceDiagram
  participant SpringBoot as SpringBootAdminApp
  participant Flyway as FlywayAutoConfiguration
  participant DB as PostgreSQLAdminDatabase

  SpringBoot->>SpringBoot: loadApplicationContext
  SpringBoot->>Flyway: createFlywayBeans
  Flyway->>DB: connect
  Flyway->>DB: checkFlywaySchemaHistory
  Flyway->>DB: scanAppliedMigrations
  Flyway->>SpringBoot: readProperties(locations,baselineOnMigrate,baselineVersion,validateOnMigrate)
  Flyway->>DB: scanPendingMigrations(classpath_db_migration)
  Flyway->>DB: applyMigration(V1_202603092010__create_i18n_menu)
  Flyway->>DB: applyMigration(V2_202603092010__insert_i18n_menu)
  Flyway->>DB: applyMigration(V3_202603092010__update_menu)
  Flyway-->>SpringBoot: migrationsComplete
  SpringBoot-->>SpringBoot: finishStartup
Loading

ER diagram for sys_i18n_menu and related menu data

erDiagram
  SYS_MENU {
    bigint id PK
    varchar name
    varchar path
  }

  SYS_I18N_MENU {
    bigint id PK
    bigint creator
    bigint editor
    timestamp create_time
    timestamp update_time
    smallint del_flag
    int version
    bigint tenant_id
    bigint dept_id
    varchar code
    varchar menu
  }

  SYS_MENU ||--o{ SYS_I18N_MENU : localized_by
Loading

File-Level Changes

Change Details Files
Switch database migration framework from Liquibase to Flyway across the project and admin infrastructure module.
  • Replace liquibase-core dependency with flyway-core and flyway-database-postgresql in the parent POM dependencyManagement section, introducing a new flyway.version property.
  • Update laokou-admin-infrastructure module POM to depend on Flyway (flyway-core, flyway-database-postgresql, spring-boot-flyway) instead of Liquibase (liquibase-core, spring-boot-liquibase).
pom.xml
laokou-service/laokou-admin/laokou-admin-infrastructure/pom.xml
Reconfigure Spring Boot database migration settings from Liquibase to Flyway for admin services.
  • Replace spring.liquibase configuration with spring.flyway in the admin service application.yml, specifying locations, baseline-on-migrate, baseline-version, and validate-on-migrate.
  • Apply the same Flyway configuration switch in the standalone admin service application.yml.
laokou-service/laokou-admin/laokou-admin-start/src/main/resources/application.yml
laokou-service/laokou-standalone/laokou-standalone-admin/laokou-standalone-admin-start/src/main/resources/application.yml
Convert existing Liquibase SQL changelog scripts for i18n menu into Flyway migration scripts for the admin service.
  • Move SQL files from db/changelog/sql to db/migration and rename them to Flyway versioned filenames (V1_..., V2_..., V3_...).
  • Strip Liquibase-specific formatting comments (e.g., 'liquibase formatted sql' and 'changeset' headers) from the SQL scripts, leaving plain SQL for Flyway to run.
laokou-service/laokou-admin/laokou-admin-start/src/main/resources/db/changelog/sql/000001_create_i18n_menu.sql
laokou-service/laokou-admin/laokou-admin-start/src/main/resources/db/changelog/sql/000002_insert_i18n_menu.sql
laokou-service/laokou-admin/laokou-admin-start/src/main/resources/db/changelog/sql/000003_update_menu.sql
laokou-service/laokou-admin/laokou-admin-start/src/main/resources/db/migration/V1_202603092010__create_i18n_menu.sql
laokou-service/laokou-admin/laokou-admin-start/src/main/resources/db/migration/V2_202603092010__insert_i18n_menu.sql
laokou-service/laokou-admin/laokou-admin-start/src/main/resources/db/migration/V3_202603092010__update_menu.sql
Introduce equivalent Flyway migration scripts for the i18n menu in the standalone admin service.
  • Add Flyway V1 migration to create the sys_i18n_menu table (with schema, comments, index, and primary key).
  • Add Flyway V2 migration to insert seed data rows into sys_i18n_menu.
  • Add Flyway V3 migration to update an existing sys_menu entry to point to the i18n menu path.
laokou-service/laokou-standalone/laokou-standalone-admin/laokou-standalone-admin-start/src/main/resources/db/migration/V1_202603092010__create_i18n_menu.sql
laokou-service/laokou-standalone/laokou-standalone-admin/laokou-standalone-admin-start/src/main/resources/db/migration/V2_202603092010__insert_i18n_menu.sql
laokou-service/laokou-standalone/laokou-standalone-admin/laokou-standalone-admin-start/src/main/resources/db/migration/V3_202603092010__update_menu.sql
Remove Liquibase-specific database objects and changelog descriptors from the codebase.
  • Drop creation of Liquibase metadata tables (databasechangelog and databasechangeloglock) from the Nacos SQL initialization script.
  • Delete Liquibase master changelog XML files for both admin and standalone admin services.
doc/db/4.0.0/kcloud_platform_nacos.sql
laokou-service/laokou-admin/laokou-admin-start/src/main/resources/db/changelog/db.changelog-master.xml
laokou-service/laokou-standalone/laokou-standalone-admin/laokou-standalone-admin-start/src/main/resources/db/changelog/db.changelog-master.xml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@KouShenhai KouShenhai merged commit cb11c2b into master Mar 11, 2026
12 of 16 checks passed
@coderabbitai
Copy link

coderabbitai bot commented Mar 11, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: ddc1b1c4-ea28-42fa-82bb-8740f1d675b1

📥 Commits

Reviewing files that changed from the base of the PR and between 953caa9 and 81dd03c.

📒 Files selected for processing (15)
  • README.adoc
  • archive/docs/00.二开指南/02.指南/21.Flyway配置.md
  • doc/db/4.0.0/kcloud_platform_nacos.sql
  • laokou-service/laokou-admin/laokou-admin-infrastructure/pom.xml
  • laokou-service/laokou-admin/laokou-admin-start/src/main/resources/application.yml
  • laokou-service/laokou-admin/laokou-admin-start/src/main/resources/db/changelog/db.changelog-master.xml
  • laokou-service/laokou-admin/laokou-admin-start/src/main/resources/db/migration/V1_202603092010__create_i18n_menu.sql
  • laokou-service/laokou-admin/laokou-admin-start/src/main/resources/db/migration/V2_202603092010__insert_i18n_menu.sql
  • laokou-service/laokou-admin/laokou-admin-start/src/main/resources/db/migration/V3_202603092010__update_menu.sql
  • laokou-service/laokou-standalone/laokou-standalone-admin/laokou-standalone-admin-start/src/main/resources/application.yml
  • laokou-service/laokou-standalone/laokou-standalone-admin/laokou-standalone-admin-start/src/main/resources/db/changelog/db.changelog-master.xml
  • laokou-service/laokou-standalone/laokou-standalone-admin/laokou-standalone-admin-start/src/main/resources/db/migration/V1_202603092010__create_i18n_menu.sql
  • laokou-service/laokou-standalone/laokou-standalone-admin/laokou-standalone-admin-start/src/main/resources/db/migration/V2_202603092010__insert_i18n_menu.sql
  • laokou-service/laokou-standalone/laokou-standalone-admin/laokou-standalone-admin-start/src/main/resources/db/migration/V3_202603092010__update_menu.sql
  • pom.xml

Walkthrough

This PR systematically replaces Liquibase with Flyway as the database migration framework across the project, updating dependencies, configuration files, migration scripts, documentation, and removing Liquibase-specific tracking tables and changelog structures.

Changes

Cohort / File(s) Summary
Documentation
README.adoc, archive/docs/.../21.Flyway配置.md
Updated README to reference Flyway instead of Liquibase; added comprehensive Flyway configuration guide covering dependencies, YAML configuration, migration script conventions, and Flyway vs Liquibase comparison.
Dependency Management
pom.xml, laokou-service/laokou-admin/laokou-admin-infrastructure/pom.xml, laokou-service/laokou-standalone/.../laokou-standalone-admin-start/pom.xml
Removed liquibase-core and related dependencies; added flyway-core, flyway-database-postgresql, and spring-boot-flyway; introduced flyway.version property.
Configuration Files
laokou-service/laokou-admin/.../application.yml, laokou-service/laokou-standalone/.../application.yml
Replaced Liquibase change-log configuration with Flyway locations setting to classpath:db/migration; added baseline-on-migrate, baseline-version, and validate-on-migrate properties.
Liquibase Schema Artifacts
doc/db/4.0.0/kcloud_platform_nacos.sql
Removed creation statements for public.databasechangeloglock and public.databasechangelog tracking tables.
Admin Service Migrations
laokou-service/laokou-admin/.../db/changelog/db.changelog-master.xml, laokou-service/laokou-admin/.../db/migration/V[1-3]_*.sql
Removed Liquibase master changelog XML file; converted three SQL migration files (create i18n menu, insert data, update menu) by stripping Liquibase-formatted SQL headers and changeset wrappers, leaving plain DDL/DML statements.
Standalone Service Migrations
laokou-service/laokou-standalone/.../db/changelog/db.changelog-master.xml, laokou-service/laokou-standalone/.../db/migration/V[1-3]_*.sql
Removed Liquibase master changelog XML file; added three new Flyway migration files with plain SQL (create sys_i18n_menu table, insert 29 i18n menu entries, update sys_menu entry).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • KouShenhai/KCloud-Platform-IoT#5834: Adds Liquibase-formatted changelogs and i18n menu SQL migrations, directly inverse to this PR's removal and Flyway conversion of the same migrations.

Suggested labels

Review effort 4/5

Poem

🐰 From Liquibase chains we hoppy now escape,
Flyway's clean migrations take new shape,
With V-numbered scripts in ordered flight,
Our database evolves, migration-right! ✨

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dev

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@qodo-code-review
Copy link

Review Summary by Qodo

Migrate database migration tool from Liquibase to Flyway

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Replace Liquibase with Flyway for database migration management
• Update Maven dependencies from liquibase-core to flyway-core and flyway-database-postgresql
• Migrate database migration scripts from XML changelog format to Flyway SQL naming convention
• Update Spring Boot configuration to use Flyway settings instead of Liquibase
• Remove Liquibase-specific database tables (databasechangelog, databasechangeloglock)
• Add comprehensive Flyway configuration documentation with comparison to Liquibase
Diagram
flowchart LR
  Liquibase["Liquibase<br/>XML Changelogs"] -->|Replace| Flyway["Flyway<br/>SQL Scripts"]
  Liquibase -->|Remove Tables| OldTables["databasechangelog<br/>databasechangeloglock"]
  Flyway -->|Create Table| NewTable["flyway_schema_history"]
  Config["application.yml<br/>Configuration"] -->|Update| FlywayConfig["flyway.locations<br/>baseline-on-migrate"]
  Dependencies["pom.xml<br/>Dependencies"] -->|Update| FlywayDeps["flyway-core<br/>flyway-database-postgresql"]
Loading

Grey Divider

File Changes

1. README.adoc 📝 Documentation +1/-1

Update database migration tool reference

README.adoc


2. archive/docs/00.二开指南/02.指南/21.Flyway配置.md 📝 Documentation +90/-0

Add comprehensive Flyway configuration guide

archive/docs/00.二开指南/02.指南/21.Flyway配置.md


3. doc/db/4.0.0/kcloud_platform_nacos.sql ⚙️ Configuration changes +1/-30

Remove Liquibase-specific database tables

doc/db/4.0.0/kcloud_platform_nacos.sql


View more (12)
4. laokou-service/laokou-admin/laokou-admin-infrastructure/pom.xml Dependencies +10/-12

Replace Liquibase with Flyway dependencies

laokou-service/laokou-admin/laokou-admin-infrastructure/pom.xml


5. laokou-service/laokou-admin/laokou-admin-start/src/main/resources/application.yml ⚙️ Configuration changes +5/-2

Update Liquibase config to Flyway settings

laokou-service/laokou-admin/laokou-admin-start/src/main/resources/application.yml


6. laokou-service/laokou-admin/laokou-admin-start/src/main/resources/db/changelog/db.changelog-master.xml ⚙️ Configuration changes +0/-10

Remove Liquibase XML changelog master file

laokou-service/laokou-admin/laokou-admin-start/src/main/resources/db/changelog/db.changelog-master.xml


7. laokou-service/laokou-admin/laokou-admin-start/src/main/resources/db/migration/V1_202603092010__create_i18n_menu.sql ⚙️ Configuration changes +0/-3

Convert to Flyway SQL migration format

laokou-service/laokou-admin/laokou-admin-start/src/main/resources/db/migration/V1_202603092010__create_i18n_menu.sql


8. laokou-service/laokou-admin/laokou-admin-start/src/main/resources/db/migration/V2_202603092010__insert_i18n_menu.sql ⚙️ Configuration changes +0/-3

Convert to Flyway SQL migration format

laokou-service/laokou-admin/laokou-admin-start/src/main/resources/db/migration/V2_202603092010__insert_i18n_menu.sql


9. laokou-service/laokou-admin/laokou-admin-start/src/main/resources/db/migration/V3_202603092010__update_menu.sql ⚙️ Configuration changes +0/-3

Convert to Flyway SQL migration format

laokou-service/laokou-admin/laokou-admin-start/src/main/resources/db/migration/V3_202603092010__update_menu.sql


10. laokou-service/laokou-standalone/laokou-standalone-admin/laokou-standalone-admin-start/src/main/resources/application.yml ⚙️ Configuration changes +5/-2

Update Liquibase config to Flyway settings

laokou-service/laokou-standalone/laokou-standalone-admin/laokou-standalone-admin-start/src/main/resources/application.yml


11. laokou-service/laokou-standalone/laokou-standalone-admin/laokou-standalone-admin-start/src/main/resources/db/changelog/db.changelog-master.xml ⚙️ Configuration changes +0/-7

Remove Liquibase XML changelog master file

laokou-service/laokou-standalone/laokou-standalone-admin/laokou-standalone-admin-start/src/main/resources/db/changelog/db.changelog-master.xml


12. laokou-service/laokou-standalone/laokou-standalone-admin/laokou-standalone-admin-start/src/main/resources/db/migration/V1_202603092010__create_i18n_menu.sql ⚙️ Configuration changes +34/-0

Add Flyway SQL migration for table creation

laokou-service/laokou-standalone/laokou-standalone-admin/laokou-standalone-admin-start/src/main/resources/db/migration/V1_202603092010__create_i18n_menu.sql


13. laokou-service/laokou-standalone/laokou-standalone-admin/laokou-standalone-admin-start/src/main/resources/db/migration/V2_202603092010__insert_i18n_menu.sql ⚙️ Configuration changes +29/-0

Add Flyway SQL migration for data insertion

laokou-service/laokou-standalone/laokou-standalone-admin/laokou-standalone-admin-start/src/main/resources/db/migration/V2_202603092010__insert_i18n_menu.sql


14. laokou-service/laokou-standalone/laokou-standalone-admin/laokou-standalone-admin-start/src/main/resources/db/migration/V3_202603092010__update_menu.sql ⚙️ Configuration changes +1/-0

Add Flyway SQL migration for data update

laokou-service/laokou-standalone/laokou-standalone-admin/laokou-standalone-admin-start/src/main/resources/db/migration/V3_202603092010__update_menu.sql


15. pom.xml Dependencies +10/-5

Update parent POM with Flyway version

pom.xml


Grey Divider

Qodo Logo

@qodo-code-review
Copy link

qodo-code-review bot commented Mar 11, 2026

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider


Action required

1. Destructive Flyway V1 migration 🐞 Bug ⛯ Reliability
Description
V1_202603092010__create_i18n_menu.sql drops public.sys_i18n_menu, so the first Flyway run can
delete an existing table (and its data) instead of performing an additive migration. With
baseline-on-migrate: true and baseline-version: 0, Flyway will still run V1+ on non-empty
schemas, making this data loss likely during upgrades.
Code

laokou-service/laokou-admin/laokou-admin-start/src/main/resources/db/migration/V1_202603092010__create_i18n_menu.sql[R1-2]

DROP TABLE IF EXISTS "public"."sys_i18n_menu";
CREATE TABLE "public"."sys_i18n_menu" (
Evidence
The migration explicitly drops the table, and Flyway is enabled with baseline behavior that will
execute versioned migrations on first run against an existing schema. The repository also contains
an initialization SQL that creates and seeds sys_i18n_menu, demonstrating that real deployments
can already have this table populated before Flyway is introduced—so running V1 would delete that
existing data.

laokou-service/laokou-admin/laokou-admin-start/src/main/resources/db/migration/V1_202603092010__create_i18n_menu.sql[1-4]
laokou-service/laokou-admin/laokou-admin-start/src/main/resources/application.yml[127-132]
doc/db/4.0.0/kcloud_platform.sql[181-219]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The Flyway V1 migration drops `public.sys_i18n_menu`, which can delete existing data when Flyway runs for the first time on a non-empty schema.

## Issue Context
Flyway is enabled with `baseline-on-migrate: true` and `baseline-version: 0`, which will allow Flyway to start tracking an existing schema and then execute V1+ migrations. The repo also includes an initialization script that already creates and seeds `sys_i18n_menu`, so it’s plausible that environments already contain data in this table.

## Fix Focus Areas
- laokou-service/laokou-admin/laokou-admin-start/src/main/resources/db/migration/V1_202603092010__create_i18n_menu.sql[1-14]
- laokou-service/laokou-admin/laokou-admin-start/src/main/resources/application.yml[127-132]
- laokou-service/laokou-standalone/laokou-standalone-admin/laokou-standalone-admin-start/src/main/resources/db/migration/V1_202603092010__create_i18n_menu.sql[1-34]
- laokou-service/laokou-standalone/laokou-standalone-admin/laokou-standalone-admin-start/src/main/resources/application.yml[129-134]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. I18nMenu schema mismatch 🐞 Bug ✓ Correctness
Description
The Flyway migrations create/seed table sys_i18n_menu with columns like code and menu, but the
I18nMenu persistence layer queries sys_i18n_message and maps zhMessage/enMessage fields. This
mismatch means the seeded data won’t be read by the application and can also cause runtime SQL
errors if sys_i18n_message (or its expected columns) doesn’t exist.
Code

laokou-service/laokou-admin/laokou-admin-start/src/main/resources/db/migration/V1_202603092010__create_i18n_menu.sql[R1-3]

DROP TABLE IF EXISTS "public"."sys_i18n_menu";
CREATE TABLE "public"."sys_i18n_menu" (
	"id" int8 NOT NULL GENERATED BY DEFAULT AS IDENTITY,
Evidence
The migration clearly creates sys_i18n_menu with a menu column, while the Java DO/mapper are
hard-coded to sys_i18n_message and the domain/DO expect zhMessage and enMessage fields.
Therefore, the newly created/seeding schema is not aligned with the runtime queries/models.

laokou-service/laokou-admin/laokou-admin-start/src/main/resources/db/migration/V1_202603092010__create_i18n_menu.sql[1-14]
laokou-service/laokou-admin/laokou-admin-infrastructure/src/main/java/org/laokou/admin/i18nMenu/gatewayimpl/database/dataobject/I18nMenuDO.java[29-47]
laokou-service/laokou-admin/laokou-admin-infrastructure/src/main/resources/mapper/i18nMenu/I18nMenuMapper.xml[23-42]
laokou-service/laokou-admin/laokou-admin-domain/src/main/java/org/laokou/admin/i18nMenu/model/I18nMenuE.java[27-49]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Flyway migrations create/seed `sys_i18n_menu(code, menu, ...)`, but the application reads from `sys_i18n_message` and expects `zhMessage`/`enMessage` fields, so the new schema/data won’t be used and queries can fail.

## Issue Context
The migration scripts added/modified in this PR appear to be introducing an “国际化菜单” table and seed rows. However, the `I18nMenuDO` and `I18nMenuMapper.xml` are still hard-coded to `sys_i18n_message`, and the domain model contains `zhMessage/enMessage` rather than `menu`.

## Fix Focus Areas
- laokou-service/laokou-admin/laokou-admin-start/src/main/resources/db/migration/V1_202603092010__create_i18n_menu.sql[1-14]
- laokou-service/laokou-admin/laokou-admin-start/src/main/resources/db/migration/V2_202603092010__insert_i18n_menu.sql[1-29]
- laokou-service/laokou-admin/laokou-admin-infrastructure/src/main/java/org/laokou/admin/i18nMenu/gatewayimpl/database/dataobject/I18nMenuDO.java[29-47]
- laokou-service/laokou-admin/laokou-admin-infrastructure/src/main/resources/mapper/i18nMenu/I18nMenuMapper.xml[23-42]
- laokou-service/laokou-admin/laokou-admin-domain/src/main/java/org/laokou/admin/i18nMenu/model/I18nMenuE.java[27-49]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - 我发现了 1 个问题,并给出了一些总体层面的反馈:

  • admin 模块和 standalone 模块的 Flyway 迁移脚本是重复的(V1–V3 文件中的 SQL 完全相同);建议抽取公共迁移脚本或复用一个共享模块,以避免将来脚本发生偏差。
  • 在共享 SQL 中删除 Liquibase 元数据表(databasechangelog*)并移除 Liquibase 依赖,前提是假设当前没有任何环境仍依赖它们;请确认所有部署环境都已完全迁移到 Flyway,或者提供一个向后兼容的过渡方案。
面向 AI 代理的提示
Please address the comments from this code review:

## Overall Comments
- The Flyway migration scripts for admin and standalone modules are duplicated (V1–V3 files with identical SQL); consider extracting shared migrations or reusing a common module to avoid divergence over time.
- Dropping Liquibase metadata tables (`databasechangelog*`) from the shared SQL and removing Liquibase dependencies assumes no existing environments still rely on them; verify that all deployments are fully migrated to Flyway or provide a backward-compatible transition path.

## Individual Comments

### Comment 1
<location path="laokou-service/laokou-admin/laokou-admin-start/src/main/resources/application.yml" line_range="130-132" />
<code_context>
+    # SQL脚本存放路径,默认是 classpath:db/migration
+    locations: classpath:db/migration
+    # 第一次运行环境是否自动执行基准迁移(当已有数据库表时需开启)
+    baseline-on-migrate: true
+	# 基准版本号,默认为 1
+    baseline-version: 1
</code_context>
<issue_to_address>
**question (bug_risk):** Flyway `baseline-on-migrate` with `baseline-version: 0` may not match the intent for existing schemas starting at V1.

On existing schemas, this setup will cause Flyway to rerun V1+ migrations that have already been applied (e.g., previously via Liquibase), potentially reapplying DDL/data changes. If the existing schema should be treated as the starting point for V1, set `baseline-version` to the version that matches your first migration so Flyway does not re-execute those scripts.
</issue_to_address>

Sourcery 对开源项目是免费的——如果你觉得我们的评审有帮助,欢迎分享 ✨
帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈改进后续评审。
Original comment in English

Hey - I've found 1 issue, and left some high level feedback:

  • The Flyway migration scripts for admin and standalone modules are duplicated (V1–V3 files with identical SQL); consider extracting shared migrations or reusing a common module to avoid divergence over time.
  • Dropping Liquibase metadata tables (databasechangelog*) from the shared SQL and removing Liquibase dependencies assumes no existing environments still rely on them; verify that all deployments are fully migrated to Flyway or provide a backward-compatible transition path.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The Flyway migration scripts for admin and standalone modules are duplicated (V1–V3 files with identical SQL); consider extracting shared migrations or reusing a common module to avoid divergence over time.
- Dropping Liquibase metadata tables (`databasechangelog*`) from the shared SQL and removing Liquibase dependencies assumes no existing environments still rely on them; verify that all deployments are fully migrated to Flyway or provide a backward-compatible transition path.

## Individual Comments

### Comment 1
<location path="laokou-service/laokou-admin/laokou-admin-start/src/main/resources/application.yml" line_range="130-132" />
<code_context>
+    # SQL脚本存放路径,默认是 classpath:db/migration
+    locations: classpath:db/migration
+    # 第一次运行环境是否自动执行基准迁移(当已有数据库表时需开启)
+    baseline-on-migrate: true
+	# 基准版本号,默认为 1
+    baseline-version: 1
</code_context>
<issue_to_address>
**question (bug_risk):** Flyway `baseline-on-migrate` with `baseline-version: 0` may not match the intent for existing schemas starting at V1.

On existing schemas, this setup will cause Flyway to rerun V1+ migrations that have already been applied (e.g., previously via Liquibase), potentially reapplying DDL/data changes. If the existing schema should be treated as the starting point for V1, set `baseline-version` to the version that matches your first migration so Flyway does not re-execute those scripts.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +130 to +132
baseline-on-migrate: true
baseline-version: 0
validate-on-migrate: true
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question (bug_risk): Flyway baseline-on-migrate 配合 baseline-version: 0 时,可能与以 V1 为起点的现有 schema 的设计意图不一致。

在已有 schema 的情况下,这种配置会让 Flyway 重新执行那些已经应用过的 V1+ 迁移(例如此前通过 Liquibase 执行的),从而可能重复执行 DDL/数据变更。如果现有 schema 应被视为从 V1 开始的基准状态,请将 baseline-version 设置为与你第一个迁移脚本相匹配的版本号,以避免 Flyway 再次执行这些脚本。

Original comment in English

question (bug_risk): Flyway baseline-on-migrate with baseline-version: 0 may not match the intent for existing schemas starting at V1.

On existing schemas, this setup will cause Flyway to rerun V1+ migrations that have already been applied (e.g., previously via Liquibase), potentially reapplying DDL/data changes. If the existing schema should be treated as the starting point for V1, set baseline-version to the version that matches your first migration so Flyway does not re-execute those scripts.

Comment on lines 1 to 2
DROP TABLE IF EXISTS "public"."sys_i18n_menu";
CREATE TABLE "public"."sys_i18n_menu" (

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

1. Destructive flyway v1 migration 🐞 Bug ⛯ Reliability

V1_202603092010__create_i18n_menu.sql drops public.sys_i18n_menu, so the first Flyway run can
delete an existing table (and its data) instead of performing an additive migration. With
baseline-on-migrate: true and baseline-version: 0, Flyway will still run V1+ on non-empty
schemas, making this data loss likely during upgrades.
Agent Prompt
## Issue description
The Flyway V1 migration drops `public.sys_i18n_menu`, which can delete existing data when Flyway runs for the first time on a non-empty schema.

## Issue Context
Flyway is enabled with `baseline-on-migrate: true` and `baseline-version: 0`, which will allow Flyway to start tracking an existing schema and then execute V1+ migrations. The repo also includes an initialization script that already creates and seeds `sys_i18n_menu`, so it’s plausible that environments already contain data in this table.

## Fix Focus Areas
- laokou-service/laokou-admin/laokou-admin-start/src/main/resources/db/migration/V1_202603092010__create_i18n_menu.sql[1-14]
- laokou-service/laokou-admin/laokou-admin-start/src/main/resources/application.yml[127-132]
- laokou-service/laokou-standalone/laokou-standalone-admin/laokou-standalone-admin-start/src/main/resources/db/migration/V1_202603092010__create_i18n_menu.sql[1-34]
- laokou-service/laokou-standalone/laokou-standalone-admin/laokou-standalone-admin-start/src/main/resources/application.yml[129-134]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines 1 to 3
DROP TABLE IF EXISTS "public"."sys_i18n_menu";
CREATE TABLE "public"."sys_i18n_menu" (
"id" int8 NOT NULL GENERATED BY DEFAULT AS IDENTITY,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

2. I18nmenu schema mismatch 🐞 Bug ✓ Correctness

The Flyway migrations create/seed table sys_i18n_menu with columns like code and menu, but the
I18nMenu persistence layer queries sys_i18n_message and maps zhMessage/enMessage fields. This
mismatch means the seeded data won’t be read by the application and can also cause runtime SQL
errors if sys_i18n_message (or its expected columns) doesn’t exist.
Agent Prompt
## Issue description
Flyway migrations create/seed `sys_i18n_menu(code, menu, ...)`, but the application reads from `sys_i18n_message` and expects `zhMessage`/`enMessage` fields, so the new schema/data won’t be used and queries can fail.

## Issue Context
The migration scripts added/modified in this PR appear to be introducing an “国际化菜单” table and seed rows. However, the `I18nMenuDO` and `I18nMenuMapper.xml` are still hard-coded to `sys_i18n_message`, and the domain model contains `zhMessage/enMessage` rather than `menu`.

## Fix Focus Areas
- laokou-service/laokou-admin/laokou-admin-start/src/main/resources/db/migration/V1_202603092010__create_i18n_menu.sql[1-14]
- laokou-service/laokou-admin/laokou-admin-start/src/main/resources/db/migration/V2_202603092010__insert_i18n_menu.sql[1-29]
- laokou-service/laokou-admin/laokou-admin-infrastructure/src/main/java/org/laokou/admin/i18nMenu/gatewayimpl/database/dataobject/I18nMenuDO.java[29-47]
- laokou-service/laokou-admin/laokou-admin-infrastructure/src/main/resources/mapper/i18nMenu/I18nMenuMapper.xml[23-42]
- laokou-service/laokou-admin/laokou-admin-domain/src/main/java/org/laokou/admin/i18nMenu/model/I18nMenuE.java[27-49]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
41.5% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@codecov
Copy link

codecov bot commented Mar 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.32%. Comparing base (7bb7496) to head (81dd03c).
⚠️ Report is 16 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #5844   +/-   ##
=========================================
  Coverage     58.32%   58.32%           
  Complexity     1144     1144           
=========================================
  Files           270      270           
  Lines          5358     5358           
  Branches        339      339           
=========================================
  Hits           3125     3125           
  Misses         2057     2057           
  Partials        176      176           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

1 participant