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:
pnpm exec junior upgradeThe 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.
Upgrade bridge for older databases
Section titled “Upgrade bridge for older databases”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:
- Install
@sentry/junior@0.107.1. - Run
pnpm exec junior upgradeand confirm it completes successfully. - Restore the intended Junior version.
- Run
pnpm exec junior upgradeagain. - Deploy the intended version, then restart workers and reopen ingress.
Fresh databases without Junior tables do not require the bridge release.
Native agent-history migration
Section titled “Native agent-history migration”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.
Example output
Section titled “Example output”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).Failure behavior
Section titled “Failure behavior”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.
Verification
Section titled “Verification”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.
Next step
Section titled “Next step”Run junior check before deploying, then continue with junior snapshot create if your plugins need sandbox dependencies.