Drizzle ORMMigrationsError Fix2026 Updated

Drizzle ORM Migration Error— push vs migrate Fix [2026]

Also covers: drizzle.config.ts · No config found · out-of-sync journal · programmatic migrate · reset migrations

January 20267 min readDrizzle ORM · drizzle-kit · PostgreSQL

⚡ Common Migration Errors

Error
No config file found. Please create a drizzle.config.ts
// OR:
Cannot find module './drizzle/meta/_journal.json'
// OR:
Error: Migrations are out of sync. Run 'drizzle-kit generate' first.

✅ Quick dev fix

terminal
npx drizzle-kit push   # syncs schema to DB — dev only

push vs generate+migrate — Which to Use

Drizzle has two migration workflows. push is for development — it directly syncs your schema to the database instantly, no files created. generate + migrate is for production — it creates versioned SQL files you review, commit, and apply in CI/CD.

1

Fix drizzle.config.ts Setup

Foundation — correct config file
3 min
drizzle.config.ts — correct setup
import { defineConfig } from "drizzle-kit"

export default defineConfig({
  schema:  "./db/schema.ts",          // path to your schema file(s)
  out:     "./drizzle",               // where migration files are stored
  dialect: "postgresql",              // or "mysql" | "sqlite"
  dbCredentials: {
    url: process.env.DATABASE_URL!,   // connection string
  },
  verbose: true,   // show SQL being applied
  strict:  true,   // prompt before destructive changes
})
.env — required environment variable
DATABASE_URL=postgresql://username:password@localhost:5432/mydb
# For Neon / Supabase:
DATABASE_URL=postgresql://user:pass@host.neon.tech/dbname?sslmode=require
2

Fix 'No Config File Found' Error

drizzle-kit can't find drizzle.config.ts
2 min
terminal — specify config path explicitly
# Default — looks for drizzle.config.ts at project root
npx drizzle-kit push

# If your config is elsewhere — specify path
npx drizzle-kit push --config ./config/drizzle.config.ts

# Verify drizzle-kit is installed
npx drizzle-kit --version

# If missing:
npm install --save-dev drizzle-kit
3

Fix Out-of-Sync Migration Journal

Journal and SQL files don't match
5 min
Fix out-of-sync migrations
# Option A — use push during development (skip migration files entirely)
npx drizzle-kit push

# Option B — regenerate from scratch (DEV ONLY — destructive in production)
# 1. Delete the drizzle/ folder
rm -rf drizzle/

# 2. Regenerate all migrations from current schema
npx drizzle-kit generate

# 3. Apply to database
npx drizzle-kit migrate

# Option C — mark a migration as applied without running it
# Edit drizzle/meta/_journal.json and add the migration entry manually
# Only do this if you've manually applied the SQL already

Never delete and regenerate migration files in a shared team environment or production system. The migration history exists for a reason — all team members' databases need to stay in sync.

4

Run Migrations Programmatically at Startup

Auto-migrate in production / CI
5 min
db/migrate.ts — programmatic migration runner
import { drizzle } from "drizzle-orm/node-postgres"
import { migrate } from "drizzle-orm/node-postgres/migrator"
import { Pool } from "pg"

async function runMigrations() {
  const pool = new Pool({ connectionString: process.env.DATABASE_URL! })
  const db = drizzle(pool)

  console.log("Running migrations...")
  await migrate(db, { migrationsFolder: "./drizzle" })
  console.log("Migrations complete")

  await pool.end()
}

runMigrations().catch((err) => {
  console.error("Migration failed:", err)
  process.exit(1)
})
package.json — migration script
{
  "scripts": {
    "db:generate": "drizzle-kit generate",
    "db:migrate":  "tsx db/migrate.ts",
    "db:push":     "drizzle-kit push",
    "db:studio":   "drizzle-kit studio"
  }
}
5

Reset and Recreate Migrations (Dev Only)

Fresh start — local development only
5 min
Full reset workflow — local dev only
# 1. Drop all tables (DANGER — destroys all data)
npx drizzle-kit drop    # interactive drop
# OR connect to DB and run: DROP SCHEMA public CASCADE; CREATE SCHEMA public;

# 2. Delete migration files
rm -rf drizzle/

# 3. Regenerate from current schema
npx drizzle-kit generate

# 4. Apply migrations
npx drizzle-kit migrate

# 5. (Optional) Seed test data
tsx db/seed.ts

Drizzle Studio is a visual database browser — run npx drizzle-kit studio to explore your tables, run queries, and debug schema issues in a browser UI.

Prevention

Frequently Asked Questions

What is the difference between drizzle-kit push and migrate?+
push directly syncs your schema to the database without creating migration files — fast for development. generate+migrate creates SQL migration files that you can review and commit to git — required for production deployments and team workflows.
Why does drizzle-kit push say 'No config file found'?+
drizzle-kit looks for drizzle.config.ts at the project root. If the file is named differently, in a subdirectory, or has an error, the command fails. Check the file exists at the root, exports a default config, and the DATABASE_URL environment variable is set.
Why are my migrations out of sync?+
The migration journal (drizzle/meta/_journal.json) tracks applied migrations. If you manually delete migration files, edit them after applying, or create them on different machines without syncing, the journal gets out of sync. The fix is to reset migrations or use drizzle-kit push for development.
How do I run Drizzle migrations automatically in production?+
Call migrate(db, { migrationsFolder: './drizzle' }) in your server startup code before the app starts handling requests. For Next.js, this can be done in a startup script or a custom server. Import db and the migrate function from drizzle-orm/node-postgres.
Should I commit migration files to git?+
Yes. Always commit the drizzle/ folder (migration SQL files and _journal.json) to git. This gives your team a history of schema changes and ensures production deployments apply migrations in the correct order. Never regenerate migrations from scratch in a team environment.
Can I use drizzle-kit push in production?+
No. push is for development only — it makes direct, potentially destructive changes without a migration trail. In production, always use generate to create migration files, review them, then run migrate to apply them safely.

Need Expert Help?

We Manage Drizzle ORM Migrations in Production

Softplix engineers set up Drizzle with safe CI/CD migration pipelines, schema versioning, and zero-downtime deploys. Let us help.

Talk to an Engineer