Moving to migrate after push, missing migrations table
During development I made extensive use of drizzle kit's
push
command. The problem is that once I went live this worked fine until I need to do my first migration.
I added a column to a table today, saved the migration, and then went to run migrate
– but because I never officially migrated my first migration, my migrate command fails. Is there anything I can do to get my migrations back in sync? Such as manually creating the migration logs table? Or specificying from which migration migrate
should run?2 Replies
Was able to fix this by adding
IF NOT EXISTS
to all of the tables and indexes created in my first migration 👍Sounds like you're using the same DB for dev and prod. It's highly recommended to use one DB for prod and another for dev, that way you can use
push
on dev and migrate
on prod (the recommended way).