Migrations and upgrades
How Open MCP Portal applies its forward-only database migrations, and how to upgrade and roll back safely.
Migrations
The database schema is managed by migrations built into the binary. They are forward-only and expand/contract: a release's migrations keep working with the previous release's code, so a rolling upgrade never breaks the replicas still running the old version.
- In Kubernetes, the
migrateinit container runsopen-mcp-portal migratein every new pod. A PostgreSQL advisory lock serialises concurrent runs, so only the first pod does any work. - Elsewhere, run
open-mcp-portal migratebefore startingserve, or setMIGRATE_ON_START=trueon a single instance. serverefuses to start while migrations are pending; the message names the current and required versions.doctorreports the migration state too.
migrate needs only DATABASE_URL.
Upgrading
- Read the release notes of every release between yours and the target. See Releases.
- Back up the database. See Backups.
- Pin the new image, by digest.
- Migrate, then roll. In Kubernetes, the new pods'
migrateinit container applies the schema before any new pod serves, while the old pods keep serving (maxUnavailable: 0). Elsewhere, runmigratewith the new image first, then restartserve. - Run
doctor.
Rolling back
Pin the previous image. Migrations are never rolled back automatically; because they are expand-only, the previous release normally runs on the newer schema. To undo a migration itself, restore the backup made before the upgrade.