feat(knowledge): add scoped activity audit trail

This commit is contained in:
wizardchen
2026-07-22 19:15:27 +08:00
committed by lyingbug
parent f195e0494c
commit a3a0308b62
44 changed files with 2429 additions and 81 deletions
@@ -0,0 +1,4 @@
DROP INDEX IF EXISTS idx_audit_logs_tenant_scope_desc;
ALTER TABLE audit_logs DROP COLUMN scope_id;
ALTER TABLE audit_logs DROP COLUMN scope_type;
@@ -0,0 +1,5 @@
ALTER TABLE audit_logs ADD COLUMN scope_type VARCHAR(32) NOT NULL DEFAULT '';
ALTER TABLE audit_logs ADD COLUMN scope_id VARCHAR(64) NOT NULL DEFAULT '';
CREATE INDEX IF NOT EXISTS idx_audit_logs_tenant_scope_desc
ON audit_logs(tenant_id, scope_type, scope_id, id DESC);