Open Chenalejandro opened 1 month ago
Seems to be the same issue as this: https://github.com/drizzle-team/drizzle-orm/issues/2599
I also faced this issue with a Postgres DB but couldn't figure out your solution on my own, so thank you for this!
What made this bug worse was that in some instances, I naturally declared my unique keys in order, and I couldn't discern why some tables were working and not others.
I do not believe this is the same issue as #2599 , as they are declaring a unique key on a single column instead of a composite unique key as in this case. Ultimately, it is the failure to discern the ordering of keys that does not match the order of declaration.
What version of
drizzle-orm
are you using?0.33.0
What version of
drizzle-kit
are you using?0.24.2
Describe the Bug
EDIT: I'm using postgresql
This code will cause
drizzle-kit push
to drop and redeclare the unique constraint (assuming that whe already run the firstdrizzle-kit push
to add the table to the db):This is the output of "drizzle-kit push --verbose"
Expected behavior
As soon as the order is fixed (declaring
uniqueValue2
afteruniqueValue1
), the error is gone:I have been dealing with this issue a long time ago. I couldn't find the root cause until today hahah.
From my testing using migration files (drizzle-kit generate && drizzle-kit migrate) will not cause this bug.
Environment & setup
No response