Documentation
¶
Overview ¶
Package migrator applies and upgrades the metaxisdata metadata schema.
This is a port of laelia's metadata migrator (backend/manager/migration/migrator.go): embedded, forward-only, semver-ordered SQL migrations with a single cumulative baseline file for fresh installs.
Layout ¶
The migration tree is embedded via go:embed:
migration/
LATEST.sql full cumulative schema at the newest version
{MAJOR.MINOR}/
{NNNN}##{desc}.sql incremental migration, version MAJOR.MINOR.NNNN
The current application version is 0.1, so incrementals live under migration/0.1/ and the baseline version is 0.1.0.
Dual-maintenance model ¶
LATEST.sql is the cumulative schema at the newest version and is applied only to fresh installs. Every future schema change must BOTH (a) append the idempotent DDL to migration/LATEST.sql AND (b) add an incremental file at migration/{MAJOR.MINOR}/{NNNN}##{desc}.sql. The incremental file is what existing deployments execute at startup; LATEST.sql is never re-run on an existing deployment.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MigrateSchema ¶
MigrateSchema migrates the metadata database schema to the latest embedded version. It is safe to call on every server startup: fresh installs apply LATEST.sql, and existing deployments apply only pending incrementals. A session-level advisory lock serializes migrations across replicas.
Types ¶
This section is empty.