-- name: IsDocumentClean :one
SELECT EXISTS(
    SELECT 1 FROM currentCleanEntries WHERE documentId = $1
);

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

-- name: GetDocumentCleanEntry :one
SELECT id, documentId, bucket, key, version
    FROM currentCleanEntries
    WHERE documentId = $1;