Confused about onConflictDoUpdate when having a constraint
I have a table that looks like
and after going through some docs, I was doing an insert like so
However, I get
PostgresError: there is no unique or exclusion constraint matching the ON CONFLICT specification
What am I doing incorrect here?3 Replies
i also been having quite a few problems with adding constraints - in my case its slightly more complicated with joins - but in order to understand if my troubleshooting is going on the right path might I ask you what happens if you do:
because then the target would indeed match the constraint in your schema which takes into account also the year column.
let me know if it helps 🙂
Ah sweet! That fixes it! Also makes me realize I need to update the unique to be on division, week, and year 😅
that’s great, glad to be of help!