`ADD COLUMN` and `RENAME COLUMN` migration issues
Ran migrations with
drizzle-kit push:pg
before, but that gives problems in our automated workflow because it asks interactively in case of deletions.
So now i want to run it with the drizzle migrator (from node-postgres
) but that gives errors because columns already exist for ADD COLUMN
statements. I've searched the discord and followed the suggestion to edit the migration files and add IF NOT EXISTS
, that worked.
But now later migration files fail because there's RENAME COLUMN
, and that operation doesn't have a IF NOT EXISTS
option.
What can I do here? If possible I prefer not to edit migration files or the db directly.1 Reply
in case anyone reads this later; what i ended up doing was
- created the
__drizzle_migrations
table with the drizzle migrator in testing environment
- (commented out the individual lines of migrations that failed temporarily just to make it run)
- copied this table 1:1 to target env(s)
- deleted the latest rows of the migrations; the ones that still need to be applied
- (check journal json, the when
correlated to the created_at
in the table)
theres probably a better way, but at least from now ill be good