This commit is contained in:
Getlles
2026-11-16 20:34:32 +03:00
parent d475bf29ed
commit 749109aaf4
8 changed files with 363 additions and 178 deletions
+10 -1
View File
@@ -58,8 +58,17 @@ CREATE TABLE IF NOT EXISTS attachments (
updated_at TIMESTAMPTZ NOT NULL
);
CREATE TABLE IF NOT EXISTS outbox (
id UUID PRIMARY KEY,
stream VARCHAR(64) NOT NULL,
payload JSONB NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
published_at TIMESTAMPTZ
);
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 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;
ALTER TABLE attachments ADD COLUMN IF NOT EXISTS attempt INT NOT NULL DEFAULT 0;
CREATE INDEX IF NOT EXISTS idx_outbox_unpublished ON outbox(created_at) WHERE published_at IS NULL;