refactor(db): use int for attachment size and add lookup query

This commit is contained in:
kk10
2026-11-02 21:16:58 +03:00
parent 45c9f7731d
commit 983bbaa55e
9 changed files with 49 additions and 16 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ CREATE TABLE attachments (
s3_key text NOT NULL UNIQUE,
filename text NOT NULL,
content_type text NOT NULL CHECK (content_type IN ('image/png', 'image/jpeg')),
size_bytes bigint NOT NULL CHECK (size_bytes > 0 AND size_bytes <= 10485760),
size_bytes int NOT NULL CHECK (size_bytes > 0 AND size_bytes <= 10485760),
sha256 text NOT NULL CHECK (sha256 ~ '^[a-f0-9]{64}$'),
status text NOT NULL DEFAULT 'ready' CHECK (status = 'ready'),
error_code text,