Skip to main content

Database Migrations

Autentico uses explicit, versioned schema migrations. Migrations are applied automatically on startup by default — in most cases, you don't need to do anything.

How versioning works​

Autentico uses SQLite's built-in PRAGMA user_version to track the current schema version. Each release that changes the schema increments this version. On startup, the binary compares the database version against the version it expects and applies any pending migrations.

Fresh databases are automatically stamped with the current version on first start — no action needed.

Upgrading​

By default, autentico start applies pending migrations automatically. Just deploy the new binary or image and restart:

# Binary
autentico start

# Docker Compose
docker compose pull
docker compose up -d
caution

Migrations are irreversible. Back up your database file before upgrading:

cp /path/to/autentico.db /backup/autentico-$(date +%Y%m%d-%H%M%S).db

Manual migrations​

If you prefer to review and apply migrations manually, start with --no-auto-migrate:

autentico start --no-auto-migrate

The server will refuse to start if the database is behind, showing:

database is at version 1, this binary requires version 2 — run: autentico migrate

Then run the interactive migration command:

autentico migrate

This shows the current and target versions, warns about irreversibility, and asks you to type the target version number to confirm. Type anything else to cancel.

If the database is already at the latest version, startup proceeds normally with no migration work.

Already up to date​

If you run autentico migrate and the database is already at the latest version:

Already up to date.

No changes are made.