Merged in feature/mutable-metadata1 (pull request #221)
M1, M2 and M3 complete * M1, M2 and M3 complete * review changes * docs * docs
This commit is contained in:
@@ -61,7 +61,10 @@ RIGHT JOIN max_part mp ON p.part = mp.max_part_num
|
||||
GROUP BY p.part;
|
||||
|
||||
-- name: GetDocumentEnriched :one
|
||||
-- Retrieves a document with extended metadata including folder and filename
|
||||
-- Retrieves a document with extended metadata including folder and filename.
|
||||
-- Milestone 2.3a adds custom_schema_id and a correlated EXISTS probe into
|
||||
-- document_custom_metadata so GET /document/{id} can surface both fields
|
||||
-- without a follow-up query.
|
||||
SELECT
|
||||
d.id,
|
||||
d.clientId,
|
||||
@@ -69,10 +72,27 @@ SELECT
|
||||
d.folderId,
|
||||
d.filename,
|
||||
d.originalPath,
|
||||
d.file_size_bytes
|
||||
d.file_size_bytes,
|
||||
d.custom_schema_id,
|
||||
EXISTS(
|
||||
SELECT 1 FROM document_custom_metadata
|
||||
WHERE document_id = d.id
|
||||
) AS has_custom_metadata
|
||||
FROM documents d
|
||||
WHERE d.id = $1;
|
||||
|
||||
-- name: LockDocumentForLegacyExtractionWrite :one
|
||||
-- Milestone 2.5 parent-row lock acquired by CreateFieldExtraction as the
|
||||
-- FIRST DML statement inside its transaction. Serializes with AssignSchema
|
||||
-- (which takes FOR UPDATE on the same row) so the mutual-exclusivity
|
||||
-- invariant from plan Section 7.3 holds even if Trigger 2 is ever removed.
|
||||
-- Returns the current custom_schema_id so the caller can short-circuit to
|
||||
-- ErrMutualExclusivityViolation when the document is already bound.
|
||||
SELECT id, custom_schema_id
|
||||
FROM documents
|
||||
WHERE id = @document_id
|
||||
FOR UPDATE;
|
||||
|
||||
-- name: CollectDocumentS3Paths :many
|
||||
-- @sqlc-vet-disable
|
||||
-- Collect S3 bucket+key from documentEntries before deleting, for logging orphaned S3 objects
|
||||
|
||||
Reference in New Issue
Block a user