This commit is contained in:
Getlles
2026-11-16 17:38:53 +03:00
parent 3571422836
commit d475bf29ed
29 changed files with 620 additions and 228 deletions
+6 -2
View File
@@ -49,13 +49,17 @@ CREATE TABLE IF NOT EXISTS attachments (
content_type VARCHAR(50) NOT NULL,
size_bytes BIGINT NOT NULL,
sha256 VARCHAR(64) NOT NULL,
status VARCHAR(32) NOT NULL DEFAULT 'ready',
status VARCHAR(32) NOT NULL DEFAULT 'queued',
variants JSONB NOT NULL DEFAULT '[]',
error_code VARCHAR(64),
pipeline_version INT NOT NULL DEFAULT 1,
attempt INT NOT NULL DEFAULT 0,
created_at TIMESTAMPTZ NOT NULL,
updated_at TIMESTAMPTZ NOT NULL
);
CREATE INDEX IF NOT EXISTS idx_attachments_chat ON attachments(chat_id);
ALTER TABLE messages ADD COLUMN IF NOT EXISTS attachment_ids UUID[] DEFAULT '{}';
ALTER TABLE messages ADD COLUMN IF NOT EXISTS attachment_ids UUID[] DEFAULT '{}';
ALTER TABLE attachments ADD COLUMN IF NOT EXISTS pipeline_version INT NOT NULL DEFAULT 1;
ALTER TABLE attachments ADD COLUMN IF NOT EXISTS attempt INT NOT NULL DEFAULT 0;