-- name: IsDocumentTextExtracted :one
SELECT EXISTS(
    SELECT 1 FROM currentTextEntries WHERE documentId = @documentId
);

-- name: AddDocumentTextEntry :exec
INSERT INTO documentTextExtractions (version, bucket, key, cleanEntryId) VALUES ($1, $2, $3, $4);

-- name: GetDocumentTextEntry :one
SELECT id, documentId, bucket, key, version, cleanEntryId
    FROM currentTextEntries
    WHERE documentId = @documentId;
