Prepare verified laboratory 5 implementation and evidence

This commit is contained in:
rey
2026-11-17 17:32:06 +03:00
parent 276dbdad8a
commit 57a253e0b4
122 changed files with 13404 additions and 72 deletions
+15
View File
@@ -0,0 +1,15 @@
-- name: ChargeAttachment :one
UPDATE users SET attachment_count=attachment_count+1 WHERE id=$1 AND attachment_count<10000 RETURNING id;
-- name: InsertAttachment :one
INSERT INTO attachments(id,chat_id,owner_id,filename,content_type,size_bytes,sha256,status)
VALUES($1,$2,$3,$4,$5,$6,$7,'uploading') RETURNING *;
-- name: GetAttachment :one
SELECT * FROM attachments WHERE id=$1 FOR SHARE;
-- name: SetAttachmentStatus :execrows
UPDATE attachments SET status=$2,updated_at=clock_timestamp() WHERE id=$1 AND status=$3 AND pipeline_version=0;
-- name: InsertMessageAttachment :exec
INSERT INTO message_attachments(message_id,attachment_id,ordinal) VALUES($1,$2,$3);
-- name: MessageAttachments :many
SELECT attachment_id FROM message_attachments WHERE message_id=$1 ORDER BY ordinal LIMIT 10;
-- name: ReconcileAttachments :many
SELECT * FROM attachments WHERE id>$1 ORDER BY id LIMIT 101;