fix: allow tag removal in provisioner upsert (#14187)

This commit is contained in:
Garrett Delfosse
2024-08-06 11:38:55 -04:00
committed by GitHub
parent 49feb12a7f
commit fab196043e
7 changed files with 50 additions and 11 deletions

View File

@ -45,16 +45,13 @@ VALUES (
@version,
@organization_id,
@api_version
) ON CONFLICT("name", LOWER(COALESCE(tags ->> 'owner'::text, ''::text))) DO UPDATE SET
) ON CONFLICT("organization_id", "name", LOWER(COALESCE(tags ->> 'owner'::text, ''::text))) DO UPDATE SET
provisioners = @provisioners,
tags = @tags,
last_seen_at = @last_seen_at,
"version" = @version,
api_version = @api_version,
organization_id = @organization_id
WHERE
-- Only ones with the same tags are allowed clobber
provisioner_daemons.tags <@ @tags :: jsonb
RETURNING *;
-- name: UpdateProvisionerDaemonLastSeenAt :exec