22 lines
714 B
SQL
22 lines
714 B
SQL
-- 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);
|