Programmatic Migrations in Drizzle ORM

From the Drizzle ORM cheat sheet · Migrations · verified Jul 2026

Programmatic Migrations

Run migrations from your application code at startup.

typescript
import { drizzle } from 'drizzle-orm/node-postgres';
import { migrate } from 'drizzle-orm/node-postgres/migrator';

const db = drizzle(process.env.DATABASE_URL!);

// Run migrations on app startup
await migrate(db, {
  migrationsFolder: './drizzle',
});

console.log('Migrations complete');
💡 Import migrate from your specific driver path
⚡ Runs all pending migrations in order
📌 Safe to call on every startup — skips applied
🟢 Great for serverless or Docker deployments
migrationsprogrammaticstartup

Continue with Drizzle ORM

Save the full cheat sheet or work through every related task.

More Drizzle ORM tasks

Back to the full Drizzle ORM cheat sheet