Merged in jmathison/v2-upload-batch (pull request #224)
Implement v2 upload batch cleanup * Implement v2 upload batch cleanup * Merge remote-tracking branch 'origin/main' into jmathison/v2-upload-batch * Address upload batch review feedback * Raise batch worker coverage * Fix batch cleanup review issues Approved-by: Jay Brown
This commit is contained in:
@@ -108,3 +108,30 @@ FROM eulaAgreements
|
||||
WHERE eulaVersionId = $1
|
||||
ORDER BY agreedAt DESC
|
||||
LIMIT $2 OFFSET $3;
|
||||
|
||||
-- name: ActivateLocalDevEulaVersion :one
|
||||
-- Activates or updates the local development EULA version and makes it current.
|
||||
WITH cleared AS (
|
||||
UPDATE eulaVersions
|
||||
SET isCurrent = FALSE
|
||||
WHERE isCurrent = TRUE
|
||||
),
|
||||
upserted AS (
|
||||
INSERT INTO eulaVersions (version, title, content, effectiveDate, createdBy, isCurrent, activatedAt, activatedBy)
|
||||
VALUES (@version, @title, @content, NOW(), 'local-dev', TRUE, NOW(), 'local-dev')
|
||||
ON CONFLICT (version) DO UPDATE
|
||||
SET title = EXCLUDED.title,
|
||||
content = EXCLUDED.content,
|
||||
effectiveDate = EXCLUDED.effectiveDate,
|
||||
isCurrent = TRUE,
|
||||
activatedAt = NOW(),
|
||||
activatedBy = EXCLUDED.activatedBy
|
||||
RETURNING id
|
||||
)
|
||||
SELECT id FROM upserted;
|
||||
|
||||
-- name: CreateLocalDevEulaAgreement :exec
|
||||
-- Records an idempotent local development EULA agreement.
|
||||
INSERT INTO eulaAgreements (cognitoSubjectId, userEmail, eulaVersionId, agreedFromIp)
|
||||
VALUES (@cognito_subject_id, @user_email, @eula_version_id, '127.0.0.1')
|
||||
ON CONFLICT (cognitoSubjectId, eulaVersionId) DO NOTHING;
|
||||
|
||||
Reference in New Issue
Block a user