You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The third upsert will fail with SequelizeUniqueConstraintError. Removing the custom field name definition from the model will make the code work.
With a quick look, it seems like QueryInterface.prototype.upsert is trying to create a where-clause with the primary key values, but it's looking for the primary key attribute names in the values argument, which contains the values by field name instead. Thus, no where clause is created and the SQL UPDATE (in Postgres) fails.
The text was updated successfully, but these errors were encountered:
I'm getting unique constraint violation errors when using upsert with models that have primary keys with custom DB field names. For example:
The third upsert will fail with SequelizeUniqueConstraintError. Removing the custom field name definition from the model will make the code work.
With a quick look, it seems like QueryInterface.prototype.upsert is trying to create a where-clause with the primary key values, but it's looking for the primary key attribute names in the values argument, which contains the values by field name instead. Thus, no where clause is created and the SQL UPDATE (in Postgres) fails.
The text was updated successfully, but these errors were encountered: