Files
saltbo__agent-kanban/migrations/0047_task_event_offsets.sql
jarvis a2fa54a729 feat!: rebuild Agent Kanban for Realmroot Toolbox
Replace the v1 Agent/Machine runtime and CLI architecture with the v2 Resource Server, AMA-backed projections, task lifecycle, session observation, BDD specifications, and a single-package layered codebase.

BREAKING CHANGE: remove the v1 CLI, internal Agent/Machine runtime entities, workspace layout, and legacy runtime coordination APIs.
2026-09-02 00:17:52 -04:00

30 lines
897 B
SQL

CREATE TABLE task_event_offsets (
sequence INTEGER PRIMARY KEY AUTOINCREMENT,
task_id TEXT NOT NULL,
action_id TEXT UNIQUE REFERENCES task_actions(id) ON DELETE SET NULL
);
CREATE INDEX idx_task_event_offsets_task_sequence ON task_event_offsets(task_id, sequence DESC);
INSERT INTO task_event_offsets (task_id, action_id)
SELECT task_id, id
FROM task_actions
ORDER BY created_at ASC, id ASC;
CREATE TRIGGER task_actions_event_offset_after_insert
AFTER INSERT ON task_actions
BEGIN
INSERT INTO task_event_offsets (task_id, action_id) VALUES (NEW.task_id, NEW.id);
END;
CREATE TRIGGER task_actions_event_offset_after_delete
AFTER DELETE ON task_actions
BEGIN
INSERT INTO task_event_offsets (task_id, action_id) VALUES (OLD.task_id, NULL);
END;
CREATE TRIGGER tasks_event_offsets_after_delete
AFTER DELETE ON tasks
BEGIN
DELETE FROM task_event_offsets WHERE task_id = OLD.id;
END;