Cannot drop primary key
I needed to change a table from a single field PK to a composite PK, using the following syntax
I ran the drizzle kit generate, and it spat out
but this doesn't work.
I tried runnign it manually, with the addition of
SET foreign_key_checks = 0;
at the start, but no luck.
A quick google suggests the FK needs removing, but drizzle kit isn't adding that in.
Using drizzle kit 0.19.1211 Replies
FYI, the 3 fields used for the composite OK, are also FKs, if that wasn't obvious 🙂
To make it work, I have to edit the SQL file, and add a drop constraint for each FK before dropping the PK, then afterwards, re add them. I believe Drizzle Kit should understand this
@Andrew Sherman
is it sqlite?
mysql
i think drizzle kit also needs to add the
foreign_key_checks
statementsgood, agree, would be grat if you can create an issue for that so I can easily track it and get into work
will do
Any idea about the FK issue?
i'll make 2 issues, one for the
foreign_key_checks
issue and one about the need to drop FK's and re add them
@Andrew Sherman https://github.com/drizzle-team/drizzle-orm/issues/1144 and https://github.com/drizzle-team/drizzle-orm/issues/1143Perfect
I’ll take a look at it after I’ll finish batch api and a few more things in backlog
Thank you!
JSON with postgresjs is very important
😛
Some strange bug happening there
appreciate you taking your time to respond and look into it