Repository navigation
feat(thirdparty): Flyway owns the Third Party schema in every profile (#267) - #272
Merged
Merged
Conversation
…#267) Every Third Party profile now creates its schema with Flyway from the openespi-common scripts (db/migration plus db/vendor/{h2,mysql,postgres}) and Hibernate only validates it (ddl-auto: validate). V4 is the Data Custodian's handoff table and is intentionally absent; Flyway applies V1, V2, V3 and V5. - Profiles: keep local (default), dev-mysql and dev-postgresql; delete dev (HSQLDB), h2 and postgresql, and the hsqldb dependency. - Remove the POM's Maven profiles, which set properties nothing read. - Delete the legacy etc/ThirdPartyMySQL.sql dump. - openespi-common: drop spring.profiles.active from application.properties. Being .properties in the jar, it overrode each application's own application.yml default (the TP's local still started as dev-mysql). The DC's application.yml already defaults to dev-mysql. - test profile: Flyway + validate, one in-memory H2 database per context. - New schema tests for local (no profile chosen), dev-mysql and dev-postgresql (Testcontainers, skipped without Docker). - Docs: TP logins in LOCAL_TESTING.md; README run instructions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
local is now the default profile and seeds published DEV ONLY accounts (admin/admin with ROLE_CUSTODIAN, customer/customer) plus the H2 console. Bind it to 127.0.0.1 so a deployment that forgets SPRING_PROFILES_ACTIVE does not serve them to the network. dev-mysql and dev-postgresql are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Flyway: baseline-on-migrate false. No Third Party database was ever built by Flyway (Hibernate built them before #267), so baselining an existing one at V1 is never right; Flyway now stops with a clear error. README: drop and recreate an existing thirdparty database once. - Correct the naming-strategy comment in application-local.yml (it comes from openespi-common) and the H2 settings comment in application-test.yml. - Schema tests: the base class's fields are protected; LocalProfileSchemaTest no longer injects its own copies. The underlying openespi-common application.properties precedence problem is tracked in #273. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Correct stale comments: the H2 console runs on the local profile only (pom.xml), and dev-mysql/dev-postgresql no longer wait on #267 (LocalDevAccountSeedRunner Javadoc). - README: the recreate-the-database commands use IF EXISTS / --if-exists and no longer re-grant (grants on thirdparty.* survive the drop). - Schema tests: delete the round-trip row in finally; method references; drop the spring.flyway.enabled assertion, which defaulted to true. openespi-common's broken docker/prod/aws-sandbox profile files are tracked in #273. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #267.
Summary
Every Third Party profile now creates its schema with Flyway from the openespi-common scripts (
classpath:db/migrationplusdb/vendor/{h2,mysql,postgres}), the same layout as the Data Custodian. Hibernate only validates it (ddl-auto: validate); the oldupdateandcreate-dropare gone.handoff_noncestable (openespi-handoff), which the TP doesn't use. Flyway applies V1, V2, V3 and V5.local(now the default),dev-mysqlanddev-postgresql. Removeddev(HSQLDB, plus thehsqldbdependency),h2(duplicate oflocal) andpostgresql(duplicate ofdev-postgresql).local: Flyway on with the H2 scripts; the Hibernate naming-strategy overrides are removed, so it matches the tests and openespi-common.<profiles>. They set properties nothing read, so-Plocalsilently randev-mysql. The profile is chosen with-Dspring-boot.run.profiles=….locallistens on loopback only (server.address: 127.0.0.1). Becauselocalis now the default and seeds the published DEV ONLY accounts (admin/adminwithROLE_CUSTODIAN,customer/customer) and the H2 console, a deployment that forgetsSPRING_PROFILES_ACTIVEmust not serve them to the network. Before this PR the defaultdev-mysqlfailed safe (no database, no start). To reach the TP from another machine or a container, usedev-mysqlordev-postgresql.etc/ThirdPartyMySQL.sql.docs/LOCAL_TESTING.mdlists the TPadminandcustomerlogins; the TP README shows how to build and run each profile.Change outside the Third Party: openespi-common
application.propertiesopenespi-common shipped
spring.profiles.active=${SPRING_PROFILES_ACTIVE:dev-mysql}in its jar'sapplication.properties. For files at the same location Spring Boot gives.propertiesprecedence over.yml, so it overrode the TP's own default: with no profile the TP still started ondev-mysql. The line is removed, with a comment matching the existing one aboutspring.application.name. The Data Custodian is unaffected: its ownapplication.ymlalready defaults todev-mysql. The Authorization Server doesn't depend on openespi-common.Tests
testprofile now uses Flyway andvalidate, so every TP Spring test checks the entities against the scripts. Each test context gets its own in-memory database (resolves the shared-testdbnote from fix(thirdparty): address the #268 review of Third Party form login (#249) #270).ddl-autoisvalidate, and that a TP account round-trips:LocalProfileSchemaTest: starts with no profile, so it also checks the default islocalthe development accounts are seeded andserver.addressis127.0.0.1. It fails against openespi-common's oldapplication.properties.DevMysqlProfileSchemaTest(MySQL 9.5.0) andDevPostgresqlProfileSchemaTest(PostgreSQL 18): Testcontainers, skipped without Docker.Test plan
mvn verify: 106 tests, 0 failures, 6 skipped (2 pre-existing + the 4 Docker tests on Windows without Docker)local, Flyway applies 4 migrations (now at v5),customersigns inlocal: listens on127.0.0.1:8082only; the login page answers on loopback (200) and the LAN address refuses connections🤖 Generated with Claude Code