When working with migrations in PostgreSQL using Drizzle Kit, I encounter a series of challenges. Most notably, I get console errors claiming that a column already exists, even after attempts to revert the changes. Additionally, none of these changes appear to be reflected in the Supabase dashboard.
To Reproduce
Here are the steps to reproduce:
Create an initial table definition using Drizzle Kit:
Console error suggests that the column "isNotDone" already exists.
Revert the table definition to its previous state and generate a new migration file.
Run the migration script again.
Expected behavior
I expect the migration to work smoothly without throwing errors about pre-existing columns when a new column is actually being added.
Additionally, reverting changes should be straightforward and reflected in the Supabase dashboard.
Error Messages / Logs
Here are some of the console errors received:
PostgresError: column "isNotDone" of relation "todos" already exists
Moreover, each migration run logs the following notices:
Describe the bug
When working with migrations in PostgreSQL using Drizzle Kit, I encounter a series of challenges. Most notably, I get console errors claiming that a column already exists, even after attempts to revert the changes. Additionally, none of these changes appear to be reflected in the Supabase dashboard.
To Reproduce
Here are the steps to reproduce:
Create an initial table definition using Drizzle Kit:
yarn dev
to fire the migration on server startup.Add a new column to the table definition:
Expected behavior
I expect the migration to work smoothly without throwing errors about pre-existing columns when a new column is actually being added. Additionally, reverting changes should be straightforward and reflected in the Supabase dashboard.
Error Messages / Logs
Here are some of the console errors received:
Moreover, each migration run logs the following notices:
Questions
drizzle kit drop
be used to remove the last migration files and run the app again?Additional Context
My migration script is as follows: