TypeScript migrations for ZenStack V3

Migrations with
a direction.

Shape your database with code. Connect changes through explicit dependencies, plan each deployment, and run with the client you already use.

bun add -d @mwillbanks/zenstack-zenlev
Cross-namespace deployment graph and a superseding backfillPreview and production use separate database ledgers. Adding the column enables the new backfill and the index independently. Retiring the old column requires both. Backfill version two supersedes version one, which remains visible in history.ENVIRONMENTPreview ledgerProduction ledgerSame graphpre-deploydeploypost-deployAdd columnBuild indexBackfill v2Backfill v1Retire old columnPrerequisite to dependentSupersedes
The client factory chooses the ledger. Dependencies determine the order within it.

Plan the dependency graph

Connect migrations across namespaces. Inspect the exact order and unresolved prerequisites before execution.

Keep your configured client

Use ZenStack ORM and Kysely in one migration context, with transactional execution where the database supports it.

Write migrations as code

Use TypeScript for schema changes and data work. Review hashes, rollback compensation, and recovery decisions explicitly.

From schema change to deliberate rollout.

Start with a migration, inspect its plan, then apply the stages your deployment needs.

Read the command reference