

2·
2 years agoBefore the upsert, do a select where the result is optional. Then if_some() it was an update, if_none() it was an insert.
Looks like the on_conflict is on the ap_url, so I would use that as the key you’re trying to pull in the select.
I’m sure you’re allowed to impose legal conditions on your data, but the AI folks have very clearly shown they don’t care and would prefer to just fight it out in court years and years later, if ever.