OwnSona’s schema evolves through a Java-class-based auto-migration framework that runs at servlet startup.
Migration interfaceA single apply(Connection db) method, plus version()
(target version) and name() (for logs).
MigrationRegistryA static ordered list of Migration instances plus
CURRENT_DB_VERSION. The two must stay in lockstep; the
framework fails fast at startup otherwise.
DbMigratorRuns at MCPServer.<clinit> via runOnStartup(). Creates
a db_version bookkeeping table on first run, finds the
gap between the database’s current version and
CURRENT_DB_VERSION, applies each missing migration in a
separate transaction, recording the new version after each success.
Migration002AddRecordVersion, ...One class per applied change. Once shipped, a migration is permanent — never edit a deployed one; write a new migration that fixes or supersedes it.
Migration class is at
version 2.
db_version stays at the prior value; next
startup retries.