chore: add organization_id column to provisioner daemons (#12356)

* chore: add organization_id column to provisioner daemons
* Update upsert to include organization id on set
This commit is contained in:
Steven Masley
2024-03-06 12:04:50 -06:00
committed by GitHub
parent 46a2ff1061
commit b5f866c1cb
10 changed files with 91 additions and 44 deletions
@@ -24,6 +24,7 @@ INSERT INTO
tags,
last_seen_at,
"version",
organization_id,
api_version
)
VALUES (
@@ -34,13 +35,15 @@ VALUES (
@tags,
@last_seen_at,
@version,
@organization_id,
@api_version
) ON CONFLICT("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
api_version = @api_version,
organization_id = @organization_id
WHERE
-- Only ones with the same tags are allowed clobber
provisioner_daemons.tags <@ @tags :: jsonb