Přeskočit na obsah

Upgrading

Tento obsah zatím není dostupný ve vašem jazyce.

Adminium’s meta migrations are forward-only. There is no down. Read that sentence again before you upgrade production.

Terminal window
# 1. Back up the meta store. Not optional.
pg_dump adminium_meta > meta-backup-$(date +%F).sql
# 2. Upgrade.
docker compose pull && docker compose up -d
# or, for a from-source install
git pull && pnpm install && pnpm build
# 3. Migrations apply on boot. Or apply them yourself first:
adminium migrate

For an npm install run by systemd, the same steps are in A VPS without Docker.

Forward-only means the migration is the only direction that exists. If an upgrade goes wrong, your recovery path is restore the backup, not roll back the schema.

Terminal window
# PostgreSQL meta store
pg_dump adminium_meta > meta-backup.sql
# MySQL
mysqldump adminium_meta > meta-backup.sql
# SQLite (embedded) — .backup, not cp: WAL means the file is not the database
sqlite3 "$ADMINIUM_DATA_DIR/meta.db" ".backup 'meta-backup.db'"

And back up ADMINIUM_SECRET, if it is not already somewhere safe. A meta-store backup without the secret is a file full of ciphertext.

Adminium snapshots only the embedded SQLite meta store itself, to ADMINIUM_DATA_DIR/backups, before it migrates. A PostgreSQL or MySQL meta store gets no snapshot, so run pg_dump or mysqldump of the meta database before you start the new version. The reminder Adminium prints on that first start comes while the migrations are already running. Once they have run, the older version refuses to start on that store, and your dump is the only way back to it.

adminium start applies pending migrations before it listens. So does the container’s default command. In most cases upgrading is: pull, restart, done.

To apply them yourself — the right move when you want the migration and the restart to be separate events:

Terminal window
adminium migrate
Applied 3 migration(s) to the postgres meta store:
0007_add_widget_layouts
0008_audit_index
0009_api_key_scopes

It is idempotent. A second run applies nothing, because the ledger says so:

Meta store is up to date (postgres).

Skip the boot-time migration when you have already run it:

Terminal window
adminium start --skip-migrate
Terminal window
adminium migrate --status
migration applied note
0001_init yes
0002_connections yes
0007_add_widget_layouts no

Three notes can appear in that last column, and two of them are alarms.

A migration that already ran no longer matches what this version says it should have been. The file changed after it was applied.

This is not something to force past. It means the schema Adminium believes it has and the schema it actually has have diverged — usually because someone edited a migration in place, or a partial restore mixed two versions. Restore from backup and reapply cleanly.

The meta store contains a migration this build has never heard of — i.e. the store was written by a newer Adminium than the one you are running. You downgraded.

Adminium refuses rather than proceeding. It cannot un-apply a migration it does not have, and running an old build against a new schema corrupts data quietly rather than loudly.

The fix is to go back to the version you came from. If you genuinely need to downgrade, restore the pre-upgrade backup — which is why step 1 is step 1.

.env
ADMINIUM_VERSION=0.3.36
Terminal window
ADMINIUM_VERSION=0.5.1 docker compose up -d

latest is for evaluation. In production, pin, and upgrade deliberately — an unattended latest means a docker compose up at an unrelated moment can migrate your meta store as a side effect.

The same applies to npm. npx @adminiumjs/adminium start with no version in the spec installs any newer release it finds, without asking when no terminal is attached, and start then migrates the meta store. On a server, install an exact version into a fixed directory and move it yourself: A VPS without Docker.

A project already pins one exact version, in its package.json and in its Dockerfile’s image tag. Move both together — npm run check compares them — and read Upgrading Adminium.

The meta store is a database like any other. Restore last night’s backup somewhere else, point a new Adminium at it, run the upgrade there first. This takes ten minutes and is the difference between an upgrade and an incident.

Meta migrations only ever touch adminium_* tables. Upgrading Adminium never migrates your data. Whether Adminium can write to your database at all is decided by the role you gave it — see Read-only sources & the meta database.