Skip to content

fix(backend): activate Hibernate + Flyway in %dev and %prod profiles#181

Merged
Pratiyush merged 1 commit intomasterfrom
fix/backend/activate-hibernate-flyway-in-profiles
Apr 19, 2026
Merged

fix(backend): activate Hibernate + Flyway in %dev and %prod profiles#181
Pratiyush merged 1 commit intomasterfrom
fix/backend/activate-hibernate-flyway-in-profiles

Conversation

@Pratiyush
Copy link
Copy Markdown
Owner

Summary

  • quarkusDev has been silently broken since v0.1.0 shipped: Hibernate ORM + Flyway are forced off by the Phase 0 default, and neither %dev nor %prod re-enable them.
  • Two-line override in each of the two profile blocks. Default-block stays off so tooling-only Gradle tasks (codegen, schema probes) still boot without a DB.
  • CI passed because tests use @QuarkusTestResource with their own datasource config.

Closes

What this fixes

Before:

INFO  JPAConfig  Hibernate ORM persistence unit '<default>' was deactivated
WARN  agroal     FATAL: role "translately" does not exist
DOWN  health     Database connections health check

After (expected on a fresh docker compose up -d && ./gradlew :backend:app:quarkusDev):

INFO  Flyway     Successfully applied 4 migrations (V1..V4)
INFO  JPAConfig  Hibernate ORM persistence unit '<default>' activated
UP    health     Database connections health check
UP    health     Redis connection health check

Test plan

  • ./gradlew :backend:app:compileKotlin :backend:app:ktlintCheck — clean locally
  • CI: build + test suite stays green (IT suites self-configure via @QuarkusTestResource; they don't read the default datasource)
  • Manual verification after merge: docker compose up -d && ./gradlew :backend:app:quarkusDev, check curl http://localhost:8080/q/health reports UP for DB

Docs

docs/self-hosting/runtime-profiles.md already claimed (post-PR-#178) "Hibernate ORM is active; Flyway runs migrations on boot." The code now matches the doc.

Pre-merge

  • GPG-signed commits (author = Pratiyush)
  • Conventional Commits title
  • One intent: re-activate Hibernate + Flyway in runtime profiles
  • Surgical diff: only application.yml, only the three override lines per profile + a comment tweak
  • I have read and accept the Contributor License Agreement.

Follow-up (out of scope for this PR)

  • Add a boot-sanity CI step that hits /q/health after quarkus:build so this class of regression can't hide behind the test-only datasource config again. Will open a separate ticket.

Closes #180

Symptom: `./gradlew :backend:app:quarkusDev` boots on :8080 but every
DB-dependent request fails because:

  INFO  io.quarkus.hibernate.orm.runtime.JPAConfig — Hibernate ORM
        persistence unit '<default>' was deactivated through configuration
        properties
  WARN  io.agroal.pool — Datasource '<default>': FATAL: role "translately"
        does not exist

Root cause: the Phase 0 default block in `application.yml` set
`quarkus.hibernate-orm.active: false` + `quarkus.flyway.active: false`
so the app could boot without a running database. Every phase from v0.1.0
onward shipped real entities + migrations (V1..V4), but neither the %dev
nor %prod blocks ever flipped these back to `true`. The kill-switch
leaked into every live dev + prod boot.

Tests stayed green because every IT suite that touches the DB does so
through `@QuarkusTestResource(PostgresAndMailpitResource::class)` which
carries its own datasource config with Hibernate + Flyway on. CI never
saw the failure the live `quarkusDev` path has exhibited since v0.1.0.

Fix: add `hibernate-orm.active: true` + `flyway.active: true` +
`flyway.migrate-at-start: true` to the `%dev` and `%prod` blocks. Keep
the default-block `active: false` so tooling-only tasks
(`quarkusGenerateCode`, schema smoke probes) still work without a DB —
update that block's comment to reflect the contract.

Verified: `./gradlew :backend:app:compileKotlin :backend:app:ktlintCheck`
clean. Tests continue to stand on their own `@QuarkusTestResource` config
and aren't affected. Manual verification: user starts docker compose +
quarkusDev; health endpoint now reports DB + Redis both UP; Flyway runs
V1..V4 on first boot.

Closes #180
@Pratiyush Pratiyush merged commit 89d4004 into master Apr 19, 2026
6 checks passed
@Pratiyush Pratiyush deleted the fix/backend/activate-hibernate-flyway-in-profiles branch April 19, 2026 18:48
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.

bug(backend): %dev + %prod profiles don't reactivate Hibernate ORM + Flyway (Phase 0 default leaks)

1 participant