For the complete documentation index, see llms.txt. For a full content snapshot, see llms-full.txt. Append .md to any kestra.io/docs/* URL for plain Markdown.

Run database migrations before starting Kestra 2.0 for the first time. The migration system applies schema changes, converts V1 trigger records, rehashes BasicAuth passwords, and migrates RBAC permissions.

OSS vs. Enterprise behavior

EditionDefault behavior
Open-sourceMigrations run automatically on every startup. No configuration required.
Enterprise EditionMigrations do not run automatically (kestra.migration.auto=false by default). Kestra refuses to start if any pending migrations exist. Execute kestra migrate run before restarting.

Running migrations manually with kestra migrate run gives you full control: preview with kestra migrate plan, apply at a scheduled maintenance window, and verify before restarting your instances.

Upgrade sequence

  1. Stop all Kestra instances.
  2. Run kestra migrate plan to preview pending migrations (optional but recommended).
  3. Run kestra migrate run.
  4. Restart all Kestra instances.

Commands

kestra migrate plan

Lists all pending migrations without applying any of them. Read-only: acquires no lock, writes nothing.

kestra migrate plan

Add --sql to print the raw SQL for each SQL-based migration:

kestra migrate plan --sql

Example output:

14 pending migration(s):
2.0.01-upgrade — Schema upgrade from 1.x: drops deprecated tables, creates locks/task_outputs, adds VNode columns
2.0.07-triggers — Convert V1 trigger rows to TriggerState format
2.0.10-basic-auth-password — Rehash BasicAuth passwords from SHA-512 to bcrypt (CWE-916)
...

kestra migrate run

Applies all pending migrations in order. Acquires a distributed lock so only one process runs migrations at a time.

kestra migrate run

If the lock is already held by another process, the command exits immediately with code 1:

Migration lock is held by another process. Another instance may be running migrations.
If this is unexpected, use 'kestra migrate unlock' to force-release the lock.

kestra migrate run makes a single non-blocking lock attempt. There is no --retry or --wait option. Use kestra migrate plan to preview before running; there is no --dry-run.

kestra migrate unlock

Force-releases the migration lock. Use this only when kestra migrate run exited abnormally and left the lock held.

kestra migrate unlock

Running migrations in Docker Compose

Override the container command to run migrations as a one-off step before starting the server:

services:
kestra:
image: registry.kestra.io/docker/kestra-ee:latest
command: migrate run
# Use the same environment and volume mounts as your server service

Wait for the container to exit cleanly (exit code 0), then start the server normally:

services:
kestra:
image: registry.kestra.io/docker/kestra-ee:latest
command: server standalone

Running migrations in Kubernetes

Create a one-time Job before rolling out the updated server Pods:

apiVersion: batch/v1
kind: Job
metadata:
name: kestra-migrate
spec:
template:
spec:
containers:
- name: migrate
image: registry.kestra.io/docker/kestra-ee:latest
command: ["/app/kestra", "migrate", "run"]
# Mount the same ConfigMap and Secrets as your server Deployment
restartPolicy: Never
backoffLimit: 0

Once the Job completes successfully, roll out your updated Kestra server Deployment as usual.

What migrations run in 2.0

Kestra 2.0 applies multiple migration scripts depending on your backend and edition. Key migrations to be aware of:

scriptIdScopeDescription
2.0.01-upgradeOSS, JDBCDrops deprecated templates and executorstate tables; creates locks and task_outputs; adds VNode columns and trigger_id to executions
2.0.07-triggersOSSConverts all V1 trigger rows to the TriggerState format used in 2.0
2.0.08-ee-worker-groupsEEMigrates the Worker Group schema to the 2.0 model
2.0.10-basic-auth-passwordOSSRehashes BasicAuth passwords from SHA-512 to bcrypt (security fix, CWE-916)
2.0.11-role-permissions-eeEEMigrates RBAC permissions from the CRUD model to the Resource and Action model

Use kestra migrate plan --sql before starting Kestra 2.0 to see the full list of pending scripts and their SQL.

Configuration reference

PropertyScopeDefaultDescription
kestra.migration.autoEE onlyfalseWhen true, runs pending migrations automatically on startup. When false, Kestra refuses to start if any migrations are pending.
kestra.migration.lock-acquire-timeoutAllPT1HMaximum time the startup auto-run waits to acquire the migration lock. Does not apply to kestra migrate run, which uses a single non-blocking attempt.
kestra.migration.force-rerun-scriptsEE only[]List of scriptIds to re-execute on every startup. Use for idempotent migrations targeting in-memory stores (such as H2) that reset on JVM restart.

Was this page helpful?