Merged in feature/add-deletes (pull request #214)

support delete for client, document and folder

* support delete

for client, document and folder

* remove batch cancel conflict

not used


Approved-by: Jacob Mathison
This commit is contained in:
Jay Brown
2026-03-04 18:30:13 +00:00
parent 62b5de5722
commit 09c61ea9b4
28 changed files with 3438 additions and 632 deletions
+44
View File
@@ -14,6 +14,50 @@ UPDATE clients SET name = $1 WHERE clientId = $2;
-- name: AddClientCanSync :exec
INSERT INTO clientCanSync (canSync, clientId) VALUES ($1, $2);
-- name: GetAllDocumentIDsForClient :many
-- Get all document IDs for a client, used to cascade document deletes during client delete
SELECT id FROM documents WHERE clientId = @client_id;
-- name: DeleteCollectorMinCleanVersions :exec
-- @sqlc-vet-disable
-- Delete collector minimum clean version records for a client
DELETE FROM collectorMinCleanVersions WHERE clientId = @client_id;
-- name: DeleteCollectorActiveVersions :exec
-- @sqlc-vet-disable
-- Delete collector active version records for a client
DELETE FROM collectorActiveVersions WHERE clientId = @client_id;
-- name: DeleteCollectorVersions :exec
-- @sqlc-vet-disable
-- Delete collector version records for a client
DELETE FROM collectorVersions WHERE clientId = @client_id;
-- name: DeleteBatchUploads :exec
-- @sqlc-vet-disable
-- Delete all batch upload records for a client
DELETE FROM batch_uploads WHERE client_id = @client_id;
-- name: DeleteClientCanSync :exec
-- @sqlc-vet-disable
-- Delete clientCanSync records for a client
DELETE FROM clientCanSync WHERE clientId = @client_id;
-- name: DeleteDocumentUploadsForClient :exec
-- @sqlc-vet-disable
-- Delete all documentUploads for a client
DELETE FROM documentUploads WHERE clientId = @client_id;
-- name: DeleteAllFoldersForClient :exec
-- @sqlc-vet-disable
-- Delete all folders for a client. All documents must already be deleted to avoid FK violations.
DELETE FROM folders WHERE clientId = @client_id;
-- name: HardDeleteClient :execrows
-- @sqlc-vet-disable
-- Hard delete the client row itself. Returns the number of rows deleted (0 or 1).
DELETE FROM clients WHERE clientId = @client_id;
-- name: IsClientSynced :one
-- Text extraction has been removed. A client is considered synced when
-- all documents have completed cleaning (clean entry exists OR clean failed).