"Sorry, An error has occurred" when changing a badge sql trigger to "When a user is edited or created"

Yep… so here’s how it works. When a user updates their profile, your query is run with the user_ids parameter set to a comma-separated list of all the users who updated your profile, and you’re supposed to filter your query so that only badges/rows for those users are returned/checked.

Your query is also run daily, with the :user_ids parameter unset and :backfill set to true.

The implementation looks like this:

SELECT u.id user_id, current_timestamp granted_at
FROM ..., users u
WHERE ...
AND ...
AND (
  u.id IN (:user_ids)
  OR :backfill
)
AND ...
1 лайк