Skip to content
#drizzle#postgres#DB

A Drizzle Migration Error I Ran Into

September 21, 20261 min read2 views

I recently ran into this error while deploying a project using Drizzle ORM and PostgreSQL:

relation "comments" already exists

Drizzle was trying to run a migration that contained:

CREATE TABLE "comments" (...);

But the comments table was already in the database.

The confusing part was that the database had the table, but Drizzle's migration history didn't have a record showing that the migration had already been applied.

So the database and the migration journal were out of sync.

This can happen when tables are created manually, when drizzle-kit push and migrations are mixed, when a database is restored, or when migration files are changed between environments.

The important thing is not to immediately delete the existing table, especially if it contains production data.

Instead, first check:

  • Does the table already exist?

  • What does its current schema look like?

  • What does Drizzle's migration history contain?

  • Are the migration files the same ones being used for that database?

Once you understand the difference between the actual database schema and the migration history, you can bring them back in sync without unnecessarily deleting data.

A simple reminder for me: the database schema and migration history are two separate things, and both need to stay in sync.

Last updated Oct 29, 2026