Database Vendors
IAM owns its schema via its own dedicated Flyway instance — history table
iam_flyway_history, never your flyway_schema_history — and partitions migrations by vendor
(one consolidated V1 per vendor since 2.0.0):
db/iam/migration/├── postgresql/ V1__create_iam_schema.sql (default)└── mysql/ V1__create_iam_schema.sqlThe active set is selected by one property: iam.database.vendor resolves
classpath:db/iam/migration/<vendor>. Your spring.flyway.* configuration is never read or
modified by IAM — hosts with their own migrations keep vanilla Spring Boot defaults. To take
over IAM’s schema management entirely, set iam.database.migrations-enabled: false.
PostgreSQL (default)
Section titled “PostgreSQL (default)”Nothing to configure beyond your datasource:
spring: datasource: url: jdbc:postgresql://localhost:5432/myappruntimeOnly("org.postgresql:postgresql")runtimeOnly("org.flywaydb:flyway-core")runtimeOnly("org.flywaydb:flyway-database-postgresql")Uses native UUID, JSONB, and TIMESTAMP types.
iam: database: vendor: mysqlspring: datasource: url: jdbc:mysql://localhost:3306/myappruntimeOnly("com.mysql:mysql-connector-j")runtimeOnly("org.flywaydb:flyway-core")runtimeOnly("org.flywaydb:flyway-mysql")Requires MySQL 8.0.13+ (expression defaults, functional indexes). The MySQL schema maps types deliberately:
| PostgreSQL | MySQL | Why |
|---|---|---|
UUID |
BINARY(16) |
Hibernate 6’s default UUID mapping on MySQL |
JSONB |
JSON |
native JSON on both |
TEXT[] |
JSON array |
MySQL has no arrays; entities map List<String> as JSON on every vendor |
TIMESTAMP |
DATETIME(6) |
no 2038 limit, no TIMESTAMP auto-init quirk |
gen_random_uuid() default |
(UUID_TO_BIN(UUID())) |
expression defaults |
The entity mappings are vendor-neutral (@JdbcTypeCode(SqlTypes.JSON), no hardcoded dialect),
and the schema is verified on every boot by ddl-auto: validate — a green start is the
parity check. The repository ships a MySQL Testcontainers parity suite covering migrations,
JSON/array round-trips, and end-to-end permission resolution.
Don’t pin the dialect
Section titled “Don’t pin the dialect”Do not set hibernate.dialect yourself — Hibernate 6 auto-detects the right dialect from
JDBC metadata. A pinned PostgreSQL dialect against MySQL fails at boot with sequence-discovery
errors.
Adding another vendor
Section titled “Adding another vendor”- Author
db/iam/migration/<vendor>/V1__create_iam_schema.sqltranslating the DDL (mind: UUID storage, JSON type, timestamp semantics, upsert syntax). - Set
iam.database.vendor: <vendor>and add the driver + Flyway support module. - Boot with
ddl-auto: validateagainst a real instance — validation failures are your parity TODO list, one column at a time.