Skip to content

junior upgrade

Use junior upgrade after installing a new Junior release. The command applies pending Drizzle migrations to the database configured by DATABASE_URL.

Run the command from your Junior app:

Terminal window
pnpm exec junior upgrade

The command takes no arguments. It migrates the core Junior schema first, then the schemas owned by enabled plugins. Already-applied migrations are recognized as up to date and are not rerun.

An existing Junior database without core Drizzle migration history must complete the 0.107.1 upgrade before upgrading to a later release. Before starting this bridge, block new ingress, drain active and resumable work, stop all old workers and queue consumers, and keep them stopped until the later release is ready. If Junior reports this unsupported database state:

  1. Install @sentry/junior@0.107.1.
  2. Run pnpm exec junior upgrade and confirm it completes successfully.
  3. Restore the intended Junior version.
  4. Run pnpm exec junior upgrade again.
  5. Deploy the intended version, then restart workers and reopen ingress.

Fresh databases without Junior tables do not require the bridge release.

When upgrading from a release that writes agent_step conversation events, block new ingress, drain active and resumable work, and stop all old workers before running junior upgrade. Deploy the new runtime before restarting workers or reopening ingress. The migration rewrites existing history once, so an old worker that remains active could append a legacy event after the rewrite.

An already-current database reports its migrations as existing:

Checking database migrations...
junior: up to date (8 migrations)
junior-github: up to date (4 migrations)
junior-memory: up to date (6 migrations)
Database is up to date (18 migrations).

The command exits nonzero when it cannot connect to SQL, encounters an unsupported pre-Drizzle database, or a migration fails. Treat that as a deploy blocker: correct the reported database or migration error, then rerun the command.

Confirm that the command exits successfully and lists junior plus each enabled plugin that owns migrations. The final line reports whether the database was already current or how many migrations were applied.

Run junior check before deploying, then continue with junior snapshot create if your plugins need sandbox dependencies.