28 lines
1.0 KiB
SQL
28 lines
1.0 KiB
SQL
-- T63: Meanwhile scene support — extend scenes with a present-set discriminator
|
|
-- and a parent link (you-scene -> meanwhile child), plus a pending-digest queue.
|
|
--
|
|
-- Existing scenes table (0007) has columns:
|
|
-- id, chat_id, container_id, started_at, ended_at, significance,
|
|
-- participants_json
|
|
-- It has no `status` / `closed_at` columns. We treat `ended_at IS NULL` as
|
|
-- "active" and `ended_at IS NOT NULL` as "closed" — consistent with the
|
|
-- existing scene_opened/scene_closed handlers.
|
|
|
|
ALTER TABLE scenes ADD COLUMN present_set_kind TEXT NOT NULL DEFAULT 'you_host';
|
|
ALTER TABLE scenes ADD COLUMN parent_scene_id INTEGER;
|
|
|
|
CREATE INDEX scenes_present_set_idx
|
|
ON scenes(chat_id, present_set_kind, ended_at);
|
|
|
|
CREATE TABLE meanwhile_digest_pending (
|
|
id INTEGER PRIMARY KEY,
|
|
scene_id INTEGER NOT NULL,
|
|
chat_id TEXT NOT NULL,
|
|
summary TEXT NOT NULL,
|
|
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
consumed_at TEXT
|
|
);
|
|
|
|
CREATE INDEX meanwhile_digest_chat_idx
|
|
ON meanwhile_digest_pending(chat_id) WHERE consumed_at IS NULL;
|