whiskers.git / crates / whiskers-store / migrations / 0003_soft_actions.sql

Version 3: the log of soft deletes, so that one can be undone for a few seconds.

She puts a memory away (it is hidden, nothing is deleted) and a row says so. undo moves the memory back and stamps undone_at_ms; the core's rule says for how long that is allowed. A soft action belongs to its memory: the parents forgetting the memory deletes the row with it (ON DELETE CASCADE), so a forgotten memory has nothing left to undo and no state can say otherwise. The row holds an identity and a time, never words.

7CREATE TABLE soft_action (
8    id INTEGER PRIMARY KEY AUTOINCREMENT,
9    kind TEXT NOT NULL CHECK (kind IN ('put_away')),
10    gid TEXT NOT NULL REFERENCES fact (gid) ON DELETE CASCADE,
11    at_ms INTEGER NOT NULL,
12    undone_at_ms INTEGER
13) STRICT;
14CREATE INDEX soft_action_by_gid ON soft_action (gid);