Upsert on foreign key changes serial ID
The problem is that that even when doing nothing the employeeStoreID is being updated on the employeeStore table. This means the employeeCheckin table has an outdated value for employeeStoreID.
I use employeeStoreID as a foreign key in many places so it won't be an easy refactor to have a composite key.
2 Replies
explicitly specify a conflict target and see if that helps
@AndréLB What's the query that's causing this issue? Nothing can be updating by "doing nothing", there has to be a query being run that's causing this issue
If there's not a query in your TS/JS codebase that's causing the issue, have you verified that there aren't any DB triggers causing this?