-- name: HasDocumentCleanEntry :one
SELECT EXISTS(
    SELECT 1 FROM currentCleanEntries WHERE documentId = @documentId
);

-- name: AddDocumentCleanEntry :exec
INSERT INTO documentCleans (documentId, version, bucket, key, mimetype, fail) VALUES ($1, $2, $3, $4, $5, $6);

-- name: GetDocumentCleanEntry :one
SELECT id, documentId, bucket, key, version, mimetype, fail
    FROM currentCleanEntries
    WHERE documentId = @documentId;
