Delete Rows in Drizzle ORM
From the Drizzle ORM cheat sheet · Insert / Update / Delete · verified Jul 2026
Delete Rows
Delete rows from tables with type-safe conditions.
typescript
import { eq, lt, and } from 'drizzle-orm';
// Delete by ID
await db.delete(users).where(eq(users.id, 1));
// Delete with returning
const [deleted] = await db.delete(users)
.where(eq(users.id, 1))
.returning();
// Delete with complex condition
await db.delete(users).where(
and(
eq(users.isActive, false),
lt(users.createdAt, new Date('2024-01-01'))
)
);💡 Always use .where() to prevent deleting all!
⚡ .returning() gets deleted rows (PG/SQLite)
📌 Cascade deletes depend on FK onDelete setting
🟢 Combine with and()/or() for precise targeting
deletereturning