Skip to content

Switch from MySQL to PostgreSQL and run the server tests on it#796

Merged
krusche merged 1 commit into
developfrom
chore/switch-mysql-to-postgres
Jun 17, 2026
Merged

Switch from MySQL to PostgreSQL and run the server tests on it#796
krusche merged 1 commit into
developfrom
chore/switch-mysql-to-postgres

Conversation

@krusche

@krusche krusche commented Jun 17, 2026

Copy link
Copy Markdown
Member

Summary

Switches the application from MySQL to PostgreSQL (fresh install on prod — no data migration) and makes the server integration tests actually run on PostgreSQL via Testcontainers.

Database

  • Replaced the MySQL driver, dialect and config with PostgreSQL 18 (postgres:18-alpine) everywhere: dev/prod Spring config, docker-compose.yml, src/main/docker/*, env files, the Liquibase Gradle tooling and both local e2e runners. DB name is benchmarking; the password is supplied via env (no empty/trust auth).
  • Folded the 20 incremental, MySQL-oriented Liquibase changesets into a single PostgreSQL-native initial schema (00000000000000_initial_schema.xml). This removes the legacy MySQL property variants and the startWith="0" identity columns (illegal on Postgres). Verified by applying both the old and the new changelogs to fresh databases and diffing: identical columns (100), constraints and seed data.

Tests

  • Server tests now boot against a PostgreSQL Testcontainer (PostgreSqlTestContainer, replacing the JHipster MysqlTestContainer).
  • Repaired the previously dormant *IT suite. It had never run in CI (the test task excludes **/*IT*) and could not even start a context. Fixes: supply the Liquibase changelog path + missing benchmarking.security.* properties to the test config, activate the testprod profile, authenticate MockMvc tests with JWT (@WithMockJwt) to match the app's OAuth2 resource-server security (@WithMockUser never worked against it), initialize the Mockito mocks/captors that Boot 4's @MockitoBean no longer auto-creates, and add the missing test fixtures.
  • Restored the JHipster ExceptionTranslator (flat application/problem+json) that had been replaced by a catch-all handler returning empty 500s; InvalidPasswordException now maps to 400.
  • Added a dedicated integrationTest Gradle task and a CI step that runs it, so the integration suite cannot silently rot again.

Testing

  • ./gradlew test -x webapp29 unit tests green
  • ./gradlew integrationTest -x webapp195 integration tests green (on the Postgres Testcontainer, full schema applied)
  • Consolidated schema diffed byte-for-byte (columns/constraints/seed) against the previous one
  • ./gradlew checkstyleMain -x webapp, pnpm run prettier:check, pnpm run lint → green

Notes

  • Fresh install only — there is intentionally no migration path from existing MySQL databases.
  • CI's test job runs on ubuntu-latest (Docker available), so the new integrationTest step can start the Postgres Testcontainer.

🤖 Generated with Claude Code

Database
- Replace the MySQL driver/config with PostgreSQL 18 (postgres:18-alpine) across
  dev, prod, Docker, env files and the local e2e runners. DB name "benchmarking",
  password supplied via env.
- Fold the 20 incremental, MySQL-oriented Liquibase changesets into a single
  PostgreSQL-native initial schema (fresh install only, no data migration).
  Verified the consolidated schema is identical to the previous one: same columns,
  constraints and seed data.

Tests
- Run the server tests on a PostgreSQL Testcontainer (PostgreSqlTestContainer),
  replacing the JHipster MysqlTestContainer.
- Repair the previously dormant *IT suite (it never ran in CI and could not even
  boot a context): provide the Liquibase changelog path and the missing properties
  to the test config, activate the testprod profile, authenticate MockMvc tests via
  JWT (WithMockJwt) to match the OAuth2 resource server, initialize the Mockito
  mocks/captors, and add the missing test fixtures.
- Restore the JHipster ExceptionTranslator (flat application/problem+json) that had
  been replaced by a catch-all 500 handler; map InvalidPasswordException to 400.
- Add a dedicated `integrationTest` Gradle task and run it in CI so the integration
  suite cannot silently rot again.

All server tests green on PostgreSQL (29 unit + 195 integration).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 17, 2026 13:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@krusche krusche merged commit 4cbee5d into develop Jun 17, 2026
2 checks passed
@krusche krusche deleted the chore/switch-mysql-to-postgres branch June 17, 2026 13:53
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