This commit is contained in:
caramelteawithmint
2026-11-20 11:53:35 +03:00
parent 2b68813b33
commit f856651e57
12 changed files with 409 additions and 153 deletions
@@ -0,0 +1,13 @@
-- src/migrations/003_attachment_variants.sql
CREATE TABLE IF NOT EXISTS attachment_variants (
attachment_id uuid NOT NULL REFERENCES attachments(id) ON DELETE CASCADE,
name text NOT NULL CHECK (name IN ('thumbnail','crop','optimized')),
content_type text NOT NULL CHECK (content_type IN ('image/jpeg','image/png','image/webp')),
size_bytes bigint NOT NULL CHECK (size_bytes > 0),
width int NOT NULL CHECK (width > 0),
height int NOT NULL CHECK (height > 0),
sha256 text NOT NULL,
object_key text NOT NULL,
created_at timestamptz NOT NULL DEFAULT now(),
PRIMARY KEY (attachment_id, name)
);