Package com.onec.schema
package com.onec.schema
-
ClassDescriptionDesired state of a single column, derived from metadata.Reads the live database structure (tables and their columns) from
INFORMATION_SCHEMA, which both H2 and PostgreSQL expose.Live tables and columns, keyed by upper-cased table name.The ordered set of changes that would bring the database in line with the metadata.One change in aMigrationPlan: what it is, the SQL that performs it, and whether it can lose data (destructivechanges are skipped unlessonec.schema.allow-destructive=true).Computes theMigrationPlanthat brings the live database in line with the metadata-derivedSchemaModel.RendersCREATE TABLE IF NOT EXISTSDDL for everything in the metadata registry.Persistence foronec_schema_history: one row per applied schema change-set (kindSCHEMA, carrying the metadata snapshot and the DDL that was executed) and one row per executedAppMigration(kindMIGRATION, claimed via a unique constraint so concurrent instances run each migration exactly once).Additive-only schema evolution: adds columns that exist in the metadata model but not in the live database.How the framework treats schema differences at startup (onec.schema.mode).The full desired database state derived from theMetadataRegistry: framework tables (sequences, outbox) plus oneTableModelper catalog, document, tabular section, register, enumeration and the constants table.Builds the desiredSchemaModelfrom the metadata registry.A point-in-time record of the metadata-derived schema, persisted as JSON inonec_schema_history.Startup schema lifecycle: scans nothing itself — it takes the already-builtMetadataRegistry, derives the desiredSchemaModel, diffs it against the live database (and the previousSchemaSnapshotfromonec_schema_history), and then acts according toSchemaMode.Identifies the target database so upsert helpers can emit portable SQL.Desired state of a single table, derived from metadata.