From 6e159a33a4c761360caeb33b55cb139c1ebbc67b Mon Sep 17 00:00:00 2001 From: Alec Thomas Date: Thu, 15 Aug 2024 10:16:09 +1000 Subject: [PATCH] fix: allow conflicting artefact uploads (#2370) --- backend/controller/sql/queries.sql | 1 + backend/controller/sql/queries.sql.go | 1 + 2 files changed, 2 insertions(+) diff --git a/backend/controller/sql/queries.sql b/backend/controller/sql/queries.sql index 386d180fba..90ae6b2e55 100644 --- a/backend/controller/sql/queries.sql +++ b/backend/controller/sql/queries.sql @@ -35,6 +35,7 @@ WHERE deployment_id = $1; -- Create a new artefact and return the artefact ID. INSERT INTO artefacts (digest, content) VALUES ($1, $2) +ON CONFLICT (digest) DO NOTHING RETURNING id; -- name: AssociateArtefactWithDeployment :exec diff --git a/backend/controller/sql/queries.sql.go b/backend/controller/sql/queries.sql.go index 79b2a680dd..7dc54f6320 100644 --- a/backend/controller/sql/queries.sql.go +++ b/backend/controller/sql/queries.sql.go @@ -176,6 +176,7 @@ func (q *Queries) CompleteEventForSubscription(ctx context.Context, name string, const createArtefact = `-- name: CreateArtefact :one INSERT INTO artefacts (digest, content) VALUES ($1, $2) +ON CONFLICT (digest) DO NOTHING RETURNING id `