Skip to content

fix(config): create the dev-mode schema so quarkus:dev boots usable - #591

Merged
devops-thiago merged 1 commit into
release/v0.6.0from
fix/565-dev-schema
Aug 12, 2026
Merged

fix(config): create the dev-mode schema so quarkus:dev boots usable#591
devops-thiago merged 1 commit into
release/v0.6.0from
fix/565-dev-schema

Conversation

@devops-thiago

Copy link
Copy Markdown
Owner

What type of PR is this?

  • 🐛 Bug fix

Description

quarkus.hibernate-orm.schema-management.strategy was set only under %prod. Dev mode points at
an explicit H2 URL (jdbc:h2:mem:thrillhouse), so Quarkus starts no Dev Services database and
nothing creates the schema for it, and Hibernate's own default strategy is none. A fresh clone
running ./mvnw quarkus:dev therefore booted against a completely empty database: the app started,
/q/health answered 200, and every database-backed feature failed at runtime.

This sets %dev.quarkus.hibernate-orm.schema-management.strategy=drop-and-create, matching what
src/test/resources/application.properties already does for the test profile — which is where the
test suite has been getting its schema all along, and why nothing caught this. The dev database is
in-memory and discarded when the JVM exits, so there is nothing to preserve across boots. %prod
is untouched and keeps update, so production data is never dropped.

Only src/main/resources/application.properties changes; no Java main code and no pom.xml.

Related Issues

Fixes #565

How Has This Been Tested?

  • Unit tests
  • Integration tests
  • Manual testing

Manual: real quarkus:dev boot, before and after

Booted the app with ./mvnw quarkus:dev -Dquarkus.http.port=8099 -Dquarkus.observability.enabled=false
(JDK 25, dummy GitHub App / AI credentials so StartupConfigValidator passes), then probed the
unauthenticated DB-backed endpoint GET /session/{publicId}.

Before — app up, health green, schema absent:

ERROR [io.quarkus.hibernate.orm.runtime.schema.SchemaManagementIntegrator] (Hibernate post-boot validation thread for <default>) Failed to validate Schema: Schema validation: missing table [finding_feedback]
WARN  [org.hibernate.orm.jdbc.error] (Quarkus Main Thread) Table "REVIEWSESSION" not found; SQL statement:
WARN  [dev.thiagogonzaga.thrillhousebot.dashboard.SessionCostBackfill] (Quarkus Main Thread) Session cost backfill failed; historical dashboard costs may stay at 0: org.hibernate.exception.SQLGrammarException: Could not prepare statement [Table "REVIEWSESSION" not found; SQL statement:
INFO  [io.quarkus] (Quarkus Main Thread) thrillhousebot 0.5.1-SNAPSHOT on JVM (powered by Quarkus 3.38.0) started in 4.126s. Listening on: http://localhost:8099
GET /q/health                                        -> 200
GET /session/11111111-2222-3333-4444-555555555555    -> 500
ERROR [io.quarkus.vertx.http.runtime.QuarkusErrorHandler] (executor-thread-1) HTTP Request to /session/11111111-2222-3333-4444-555555555555 failed, error id: ee3e70f7-...: org.hibernate.exception.SQLGrammarException: Could not prepare statement [Table "REVIEWSESSION" not found; SQL statement:

After — clean boot, no schema errors anywhere in the log, and the same request reaches the
database and completes (303 to the sessions page, i.e. "no such session" rather than a crash):

INFO  [io.quarkus] (Quarkus Main Thread) thrillhousebot 0.5.1-SNAPSHOT on JVM (powered by Quarkus 3.38.0) started in 4.155s. Listening on: http://localhost:8099

GET /q/health                                        -> 200
GET /session/11111111-2222-3333-4444-555555555555    -> 303
grep -cE 'missing table|Table "REVIEWSESSION" not found' dev-after.log  -> 0

Red/green proof

DevSchemaManagementTest binds the shipped src/main/resources/application.properties under the
dev profile — the profile the suite otherwise never exercises. Verbatim red output on the
unfixed properties file:

[INFO] Running dev.thiagogonzaga.thrillhousebot.config.DevSchemaManagementTest
[ERROR] Tests run: 3, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.055 s <<< FAILURE! -- in dev.thiagogonzaga.thrillhousebot.config.DevSchemaManagementTest
[ERROR] dev.thiagogonzaga.thrillhousebot.config.DevSchemaManagementTest.devModeCreatesTheSchemaItStartsAgainst -- Time elapsed: 0.027 s <<< ERROR!
java.util.NoSuchElementException: SRCFG00014: The config property quarkus.hibernate-orm.schema-management.strategy is required but it could not be found in any config source
	at io.smallrye.config.SmallRyeConfig.convertValue(SmallRyeConfig.java:455)
	at io.smallrye.config.SmallRyeConfig.getValue(SmallRyeConfig.java:418)
	at io.smallrye.config.SmallRyeConfig.getValue(SmallRyeConfig.java:400)
	at dev.thiagogonzaga.thrillhousebot.config.DevSchemaManagementTest.devModeCreatesTheSchemaItStartsAgainst(DevSchemaManagementTest.java:47)

[ERROR] Tests run: 3, Failures: 0, Errors: 1, Skipped: 0

Green with the fix: Tests run: 3, Failures: 0, Errors: 0, Skipped: 0.

Gates

  • ./mvnw -B spotless:apply — clean
  • ./mvnw -B clean compile spotbugs:check spotless:checkBugInstance size is 0, BUILD SUCCESS
  • ./mvnw -B clean testTests run: 2771, Failures: 0, Errors: 0, Skipped: 0

Checklist

  • My code follows the project's coding standards
  • I have performed a self-review of my own code
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have updated the documentation accordingly
  • My changes generate no new warnings or errors

Additional Notes

Patch coverage: the only changed main-code file is application.properties, so the changed-line ∩
JaCoCo intersection contains no Java lines or branches — nothing uncoverable and nothing gamed.

%dev drop-and-create can only ever hit the in-memory H2 instance: the non-prod datasource URL is
a fixed jdbc:h2:mem: literal with no env override, and the test asserts that, so the strategy
cannot silently start recreating a persistent database if the URL is ever changed.

quarkus.hibernate-orm.schema-management.strategy was set only under %prod.
Dev mode points at an explicit H2 URL, so no Dev Services database is started
and nothing creates the schema for it, and Hibernate's default strategy is
none: a fresh clone booted against an empty database. The app came up and
/q/health answered 200 while post-boot validation logged
"missing table [finding_feedback]", the startup cost backfill failed, and every
DB-backed request died with Table "REVIEWSESSION" not found.

Set drop-and-create under %dev, matching what the test profile already does.
The dev database is in-memory and discarded when the JVM exits, so there is
nothing to preserve across boots; %prod keeps update and never drops anything.

Fixes #565
@github-actions

Copy link
Copy Markdown
Contributor

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@thrillhousebot

Copy link
Copy Markdown

🤖 ThrillhouseBot PR Summary

What this PR does

Adds %dev.quarkus.hibernate-orm.schema-management.strategy=drop-and-create to the shipped application.properties so dev mode — which uses an explicit in-memory H2 URL and therefore gets no Dev Services database and no schema creation — boots with a working schema instead of failing every DB-backed request, while %prod keeps update. Also adds DevSchemaManagementTest, which binds the shipped properties file under the dev and prod profiles to lock in the dev strategy, the in-memory dev JDBC URL, and the prod update strategy.

Changes Overview

  • Files changed: 2
  • Lines added: +82
  • Lines removed: 0

Changed Files

File Change Summary
src/main/resources/application.properties Modified Adds %dev.quarkus.hibernate-orm.schema-management.strategy=drop-and-create with an explanatory comment, so quarkus:dev creates the schema for the explicit in-memory H2 URL; %prod keeps update.
src/test/java/dev/thiagogonzaga/thrillhousebot/config/DevSchemaManagementTest.java Added New test binding src/main/resources/application.properties via SmallRyeConfig under dev and prod profiles, asserting dev uses drop-and-create on an in-memory H2 URL while prod still uses update.

Risk Assessment

Risk Count
🔴 Critical 0
🟠 High 0
🟡 Medium 0
🔵 Low 0

No new issues found in this PR, but the review cannot be approved until CI is confirmed green.

⚠️ CI Checks Status

Some checks are still pending or have failed:

Check Type Status Detail
trivy check-run ⏳ Pending -
actionlint check-run ⏳ Pending -
changes check-run ⏳ Pending -
test check-run ⏳ Pending -
format check-run ⏳ Pending -
frontend check-run ⏳ Pending -
dependency-review check-run ⏳ Pending -

Automated review by ThrillhouseBot. Reply with /review to re-run.

@thrillhousebot thrillhousebot Bot added bug Something isn't working testing Test coverage and test quality labels Aug 12, 2026
@codecov

codecov Bot commented Aug 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@sonarqubecloud

Copy link
Copy Markdown

@devops-thiago
devops-thiago merged commit 58e35b5 into release/v0.6.0 Aug 12, 2026
14 checks passed
@devops-thiago
devops-thiago deleted the fix/565-dev-schema branch August 12, 2026 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working testing Test coverage and test quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant