-- 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) );