Q27: knowledge corrections keep a revision history

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-10-08 05:51:32 -04:00
1 parent 18128b5ad4
commit ec9d74d128
8 files changed
+221 -5

No files matched your search

@@ -0,0 +1,24 @@
export const knowledgeRevisionsSchema = `
create table if not exists knowledge_revisions (
id text primary key,
org_id text not null references organizations(id) on delete cascade,
entry_id text not null,
revision integer not null,
topic text not null,
category text not null,
content text not null,
importance text not null,
changed_by_type text not null,
changed_by_id text,
reason text not null,
created_at text not null,
unique (entry_id, revision)
);
insert into knowledge_revisions(id, org_id, entry_id, revision, topic, category, content, importance, changed_by_type, changed_by_id, reason, created_at)
select 'knr_' || lower(hex(randomblob(16))), org_id, id, 1, topic, category, content, importance, source_type, source_id, 'created', created_at
from knowledge_entries;
insert into schema_migrations(version, name, applied_at)
values (64, 'knowledge_revisions', datetime('now'));
`;