Skip to content

build: align Flyway on 10.20.1 and verify PostgreSQL 17 (#1067) - #1073

Merged
XiaoSeS merged 4 commits into
iflytek:mainfrom
xiaoyaner0201:feat/pg17-flyway
Nov 9, 2026
Merged

XiaoSeS merged 4 commits into
iflytek:mainfrom
xiaoyaner0201:feat/pg17-flyway

Conversation

@xiaoyaner0201

Copy link
Copy Markdown
Contributor

Closes #1067

Motivation

flyway-core was managed by Spring Boot 3.2.3 as 9.22.3, while flyway-database-postgresql was pinned to 10.10.0. Flyway 9.22.3 treats PostgreSQL newer than 15 as untested, so the release image logs Flyway upgrade recommended even on the default PostgreSQL 16. The repository also did not say which PostgreSQL versions are supported.

Scope (as agreed in #1067)

  1. Flyway alignment. Both flyway-core and flyway-database-postgresql are now pinned to 10.20.1 via one flyway.version property in server/pom.xml. 10.20 is the first line with PostgreSQL 17 support, and 10.20.1 is the version Spring Boot 3.4 manages. Spring Boot itself stays at 3.2.3. The resolved dependency tree of skillhub-app differs from main only in these two coordinates.
  2. PG16 kept and PG17 added.
    • The 67 Testcontainers classes no longer hard-code postgres:16-alpine; they read PostgresTestImage.name(), which defaults to PG16 and accepts -Dskillhub.test.postgres.image=....
    • backend-tests now runs the full backend suite in a matrix over PostgreSQL 16 and 17.
    • New PostgresVersionCompatibilityTest:
      • checks that the server major matches the configured image, so the PG17 job really runs on 17
      • runs a clean full migrate + validate with no pending/failed migrations and fails if Flyway logs the unsupported-version warning
      • lets the Flyway 9.22.3 CLI (flyway/flyway:9.22.3, the engine shipped by earlier releases) migrate a database to V100, inserts user/namespace/skill/version data, validates the old history with the new engine, migrates to the latest version and validates again. Old history rows (version, script, checksum) must be unchanged and the data must survive.
    • Application startup and representative database workflows are covered by the existing @SpringBootTest/@DataJpaTest PostgreSQL tests (21 full-context classes run Flyway on startup), which now run on both versions.
  3. Docs. The FAQ (zh/en) and READMEs now separate default, verified and unverified versions.

Not included, per the issue: no change to Compose / one-click / Kustomize defaults (still PG16), no 16→17 data migration, no PG18 claim, no Spring Boot upgrade.

Spring Boot 3.2.3 compatibility notes

I checked FlywayAutoConfiguration from Boot 3.2.3 against the Flyway 10.20.1 jars at the bytecode level. The calls that no longer resolve are all on paths SkillHub does not use:

  • cherryPick, licenseKey and undoSqlMigrationPrefix (Teams-only) are applied only when the matching spring.flyway.* property is set.
  • The Oracle/SQL Server customizers are @ConditionalOnClass on modules we don't ship.
  • The PostgreSQL customizer is @ConditionalOnClass on the Flyway 9 package name. With 10.x it is skipped, so spring.flyway.postgresql.transactional-lock would be ignored. SkillHub does not set it.
  • NativeImageResourceProviderCustomizer is GraalVM native-image only.

The same was already true on main for the PostgreSQL module (10.10.0). Everything SkillHub configures (enabled, locations, datasource) goes through APIs that are unchanged.

Found while verifying (not changed here)

The Helm chart pins its bundled Bitnami PostgreSQL by digest sha256:db2312d9…, which is PostgreSQL 18.4 (postgres --version in that image). Since PG18 is out of scope, I left the chart alone and noted it in the FAQ. Helm users who want a verified version can use an external PG16/17 or override postgresql.image. Happy to follow up separately if you'd like the chart pinned to 16 or 17.

Verification

Local runs (macOS arm64, Java 21, Docker):

  • PostgresVersionCompatibilityTest
    • RED on main's Flyway (9.22.3 core) on both 16.15 and 17.11, caused by Flyway upgrade recommended: PostgreSQL 1x is newer than this version of Flyway
    • GREEN with this change on both
  • full backend suite (./mvnw -B test):
    • PG16: 1739 tests in skillhub-app plus all other modules, 0 failures

    • PG17: PostgresVersionCompatibilityTest and all migration/upgrade tests pass. In full-suite runs on my machine, a few controller.Github*IntegrationTest classes fail intermittently on PG17 (claim() returns empty, or a count of 0 where 3 is expected). This does not follow the Flyway version, so it looks like a local timing/order flake rather than a regression from this change:

      • old Flyway (9.22.3) on PG17: full suite passed (only the new compatibility test failed, as expected), but the controller.** package run failed 5 of these classes
      • new Flyway (10.20.1) on PG17: the controller.** package run passed 604/604, but full-suite runs hit the same classes
      • all controller.Github* classes (99 tests) passed in isolation for every combination of PG16/PG17 × old/new Flyway, and a schema dump after migrating V1–V121 with the 9.22.3 vs 10.20.1 CLI is byte-identical, with identical history checksums

      The new CI matrix will show whether this reproduces on GitHub runners. Similar intermittent failures in the same class appear in earlier backend-tests runs on main (e.g. run 39571013930).

  • docs site build (npm run build in docs/skillhub): passed

Rollout impact

Existing deployments keep PG16 and their Flyway history. On first start the new engine validates the existing history, which the legacy-history test covers. No schema changes or new migrations.

flyway-core was managed by Spring Boot 3.2.3 (9.22.3) while
flyway-database-postgresql was pinned to 10.10.0. Flyway 9.22.3 reports
PostgreSQL 16 and 17 as untested. Pin both artifacts to 10.20.1, the first
line with PostgreSQL 17 support and the version Spring Boot 3.4 manages.

Refs iflytek#1067

Signed-off-by: 千乘妍 (Xiaoyaner) <[email protected]>
Testcontainers tests hard-coded postgres:16-alpine. Route them through
PostgresTestImage, which keeps PG16 as the default and accepts
-Dskillhub.test.postgres.image=postgres:17-alpine.

PostgresVersionCompatibilityTest checks the server major matches the
image, runs a clean migrate/validate without Flyway's unsupported-version
warning, and upgrades a populated schema whose history was written by the
Flyway 9.22.3 CLI, keeping its checksums and data.

Refs iflytek#1067

Signed-off-by: 千乘妍 (Xiaoyaner) <[email protected]>
@XiaoSeS
XiaoSeS merged commit 258ab67 into iflytek:main Nov 9, 2026
15 checks passed
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.

[Feature] 明确 PostgreSQL 17 支持:对齐 Flyway 版本并写明受支持的 PG 版本范围

2 participants