From 10410d758c800bdc14d55b726f791a04f8202338 Mon Sep 17 00:00:00 2001 From: Toutsu Date: Thu, 4 Jun 2026 07:52:06 +0300 Subject: [PATCH] feat(db): add wizard_drafts table (V031) --- .../Migrations/V031__add_wizard_drafts.sql | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/GmRelay.Bot/Migrations/V031__add_wizard_drafts.sql diff --git a/src/GmRelay.Bot/Migrations/V031__add_wizard_drafts.sql b/src/GmRelay.Bot/Migrations/V031__add_wizard_drafts.sql new file mode 100644 index 0000000..630822a --- /dev/null +++ b/src/GmRelay.Bot/Migrations/V031__add_wizard_drafts.sql @@ -0,0 +1,21 @@ +-- V031: Per-(chat, thread, owner) wizard drafts for the game-creation wizard (issue #111). +-- Stores in-progress wizard state in JSONB with a 24h TTL managed by WizardDraftCleanupService. + +CREATE TABLE wizard_drafts ( + id UUID PRIMARY KEY, + chat_id BIGINT NOT NULL, + message_thread_id INT, + owner_telegram_id BIGINT NOT NULL, + step TEXT NOT NULL, + payload JSONB NOT NULL, + draft_message_id BIGINT, + created_at TIMESTAMPTZ NOT NULL, + updated_at TIMESTAMPTZ NOT NULL, + expires_at TIMESTAMPTZ NOT NULL +); + +CREATE INDEX idx_wizard_drafts_owner + ON wizard_drafts(chat_id, message_thread_id, owner_telegram_id); + +CREATE INDEX idx_wizard_drafts_expires + ON wizard_drafts(expires_at);