update_or_create doesn't work with unique_together fields #9551
Unanswered
olsonap
asked this question in
Potential Issue
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a model like this:
This is an unmanaged table with a clustered primary key.
The second, third, and fourth columns compose the primary key.
Using update_or_create() I can create new entries all day; HOWEVER, when I provide fields that match those unique_together fields, it updates the field1, field5, field6 columns (the non-unique together columns) for ALL rows where the primary key matches the value provided for that key.
I'm sure this is a great corner case. I can't add a new ID column to this table to use as the primary key, and none of my columns are actually unique on their own.
Beta Was this translation helpful? Give feedback.
All reactions