Skip to content

Database Migrations

Every schema change goes through a Drizzle migration. Never edit the D1 schema directly, and never edit a migration that has already been applied.

Change Drizzle schema ─▶ generate migration ─▶ review SQL ─▶ test locally ─▶ apply remotely

Migrations live in packages/database/migrations. Apply them locally:

Terminal window
pnpm --filter @kenresoft-cms/database migrate:local

pnpm run setup and pnpm run update apply remote migrations for you. Migrations run before the Workers are redeployed, so new code never meets an old schema.