feat(domain): lab5 add attachment variants and job repository contracts

This commit is contained in:
Голиков Maximillian Антон
2026-11-08 10:19:32 +03:00
parent 4413c43eb5
commit a7c7532622
4 changed files with 64 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
-- +goose Up
-- +goose StatementBegin
CREATE TABLE attachment_variants (
attachment_id UUID NOT NULL REFERENCES attachments(id) ON DELETE CASCADE,
name TEXT NOT NULL,
object_key TEXT NOT NULL,
content_type TEXT NOT NULL,
size_bytes BIGINT NOT NULL,
width INT NOT NULL,
height INT NOT NULL,
sha256 BYTEA NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
CONSTRAINT attachment_variants_pkey PRIMARY KEY (attachment_id, name),
CONSTRAINT attachment_variants_name_chk CHECK (name IN ('thumbnail', 'crop', 'webp')),
CONSTRAINT attachment_variants_size_chk CHECK (size_bytes > 0),
CONSTRAINT attachment_variants_sha256_len CHECK (octet_length(sha256) = 32)
);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP TABLE IF EXISTS attachment_variants;
-- +goose StatementEnd