substrate: sqlite state, manifest-driven housekeeping, memory tool (validated, transactional)
This commit is contained in:
Binary file not shown.
@@ -0,0 +1,25 @@
|
||||
PRAGMA foreign_keys = ON;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS entries (
|
||||
id INTEGER PRIMARY KEY,
|
||||
ring TEXT NOT NULL CHECK (ring IN ('a', 'b', 'cold')),
|
||||
type TEXT NOT NULL CHECK (type IN ('place', 'person', 'fact', 'thread')),
|
||||
label TEXT NOT NULL,
|
||||
detail TEXT NOT NULL DEFAULT '',
|
||||
created TEXT NOT NULL,
|
||||
last_touched TEXT NOT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS entries_ring_touch
|
||||
ON entries (ring, last_touched DESC, id DESC);
|
||||
|
||||
-- append-only audit journal; nothing here is ever updated or deleted
|
||||
CREATE TABLE IF NOT EXISTS events (
|
||||
id INTEGER PRIMARY KEY,
|
||||
window TEXT NOT NULL,
|
||||
op TEXT NOT NULL CHECK (op IN ('insert', 'touch', 'promote', 'demote', 'reword', 'delete', 'evict', 'revive')),
|
||||
entry_id INTEGER NOT NULL REFERENCES entries (id),
|
||||
reason TEXT NOT NULL DEFAULT ''
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS events_window ON events (window);
|
||||
Reference in New Issue
Block a user