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 `