Phase 10, part 8: the audit log, and who made what

Sign-ins and failed ones, everything admins do to users, connections,
posting accounts, each post published and email sent, pull requests and
deletions go in an audit log (schema 36), kept two years; admins read it
under Settings → Activity. Drafts, published posts and outreach emails
show who made them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 09:31:33 -07:00
co-authored by Claude Opus 5.5
parent bb4772637c
commit c8964cec12
23 changed files with 601 additions and 11 deletions
+20
View File
@@ -145,6 +145,26 @@ ALTER TABLE drafts ADD COLUMN account_id INTEGER NOT NULL DEFAULT 0; -- 0: the c
ALTER TABLE drafts ADD COLUMN written_by INTEGER NOT NULL DEFAULT 0;
ALTER TABLE drafts ADD COLUMN posted_by INTEGER NOT NULL DEFAULT 0;
ALTER TABLE drafts ADD COLUMN posted_as TEXT NOT NULL DEFAULT ''; -- the account it went out as, when it did
`,
},
// 36
{
Note: "the audit log: who did what, and who made each outreach email",
SQLite: `
CREATE TABLE audit_log (
id INTEGER PRIMARY KEY,
at TEXT NOT NULL,
user_id INTEGER NOT NULL DEFAULT 0, -- 0: Supermarket itself, or the local edition's owner
user_name TEXT NOT NULL DEFAULT '', -- as they were called then
kind TEXT NOT NULL DEFAULT 'person', -- person, agent or system
action TEXT NOT NULL, -- e.g. signin, signin-failed, invited, published, deleted
target TEXT NOT NULL DEFAULT '', -- what it was done to: an address, an account, a page
detail TEXT NOT NULL DEFAULT '',
ip TEXT NOT NULL DEFAULT ''
);
CREATE INDEX audit_log_at ON audit_log(at);
CREATE INDEX audit_log_user ON audit_log(user_id, at);
ALTER TABLE outreach ADD COLUMN created_by INTEGER NOT NULL DEFAULT 0;
`,
},
}