-- name: GetDocument :one
SELECT id, jobId, hash FROM documents WHERE id = $1 LIMIT 1;

-- name: CreateDocument :one
INSERT INTO documents (jobId, hash) VALUES ($1, $2) RETURNING id;

-- name: AddDocumentEntry :exec
INSERT INTO documentEntries (documentId, bucket, location) VALUES ($1, $2, $3);

-- name: GetDocumentIDByHash :one
SELECT id FROM documents WHERE hash = $1 and jobId = $2;