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

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

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