Package su.onno.schema
Class SchemaGenerator
java.lang.Object
su.onno.schema.SchemaGenerator
Renders
CREATE TABLE IF NOT EXISTS DDL for everything in the metadata registry.
Table layouts come from SchemaModelBuilder, the shared source of truth also used
by SchemaDiffEngine/SchemaUpgrader for evolving existing databases.
execute(Jdbi) is a fresh-database bootstrap convenience. Existing database
evolution belongs exclusively to SchemaUpgrader, which handles additions, renames,
type changes, history, and destructive-change gating.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidapplySearchIndexes(org.jdbi.v3.core.Jdbi jdbi, SqlDialect dialect) Apply the trigram search indexes best-effort: a missingpg_trgmextension (or a role without rights to create it) logs a warning and the app keeps running on LIKE scans rather than failing to boot.voidexecute(org.jdbi.v3.core.Jdbi jdbi) generateDDL(SqlDialect dialect) Index statements for every generated table, covering the columns the framework itself queries by: ref columns (auto-joins and reference expansion), catalog hierarchy parents, document dates, tabular-section owners, register periods, document refs, and dimensions.static StringgenerateSearchIndexDDL(SqlDialect dialect) PostgreSQL trigram (GIN) indexes that turn the list/searchLOWER(CAST(col AS VARCHAR)) LIKE '%term%'scan into an index lookup — the single biggest win for substring search on a large table.static Stringstatic Stringstatic String
-
Constructor Details
-
SchemaGenerator
-
-
Method Details
-
generateSequenceTableDDL
-
generateOutboxTableDDL
-
generateDDL
-
generateDDL
-
execute
public void execute(org.jdbi.v3.core.Jdbi jdbi) -
generateIndexDDL
Index statements for every generated table, covering the columns the framework itself queries by: ref columns (auto-joins and reference expansion), catalog hierarchy parents, document dates, tabular-section owners, register periods, document refs, and dimensions. Statements useIF NOT EXISTS; theSchemaUpgraderre-asserts them after applying its migration plan so existing databases pick them up on next boot. -
generateSearchIndexDDL
PostgreSQL trigram (GIN) indexes that turn the list/searchLOWER(CAST(col AS VARCHAR)) LIKE '%term%'scan into an index lookup — the single biggest win for substring search on a large table. The indexed expression is byte-for-byte the one the query services emit, so the planner actually uses it. Empty on any non-PostgreSQL dialect (H2 has no pg_trgm; it falls back to the LIKE scan), and applied best-effort byapplySearchIndexes(org.jdbi.v3.core.Jdbi, su.onno.schema.SqlDialect)sinceCREATE EXTENSIONmay require privileges the app role lacks. -
applySearchIndexes
Apply the trigram search indexes best-effort: a missingpg_trgmextension (or a role without rights to create it) logs a warning and the app keeps running on LIKE scans rather than failing to boot. A no-op on non-PostgreSQL dialects. -
sqlType
-
sqlType
-