Drizzle
Drizzle Kit has the cleanest integration: export prints the SQL representation of your current schema to stdout.
Configure Drizzle
Section titled “Configure Drizzle”import { defineConfig } from "drizzle-kit";
export default defineConfig({ dialect: "postgresql", schema: "./src/db/schema.ts",});Ensure every model is exported from the configured schema file or glob. Test the desired DDL:
pnpm exec drizzle-kit export --sql=trueConnect onwardpg
Section titled “Connect onwardpg”version = 1bundle_root = "migrations/onward"
[targets.app]schema_command = ["pnpm", "exec", "drizzle-kit", "export", "--sql=true"]dev_database_env = "ONWARDPG_DEV_DATABASE_URL"scratch_database_env = "ONWARDPG_SCRATCH_DATABASE_URL"dev_mode = "workspace"Then plan from the Drizzle model, not from Drizzle’s incremental migration folder:
pnpm exec drizzle-kit export --sql=true > /tmp/desired.sqlonwardpg config checkonwardpg plan add-booking-statusDrizzle’s export covers the schema it can represent. Add deterministic SQL to your export command for PostgreSQL objects maintained outside the Drizzle model.