Add AuditLog table and Prisma audit extension

This commit is contained in:
NeilClack
2026-09-10 15:10:11 -05:00
parent 7596937f30
commit d16965dab6
15 changed files with 2121 additions and 72 deletions
+24
View File
@@ -229,3 +229,27 @@ model ColorPalette {
@@map("ColorPalette")
}
// Append-only audit trail of database mutations. Written centrally by the
// Prisma extension in src/lib/db.ts; read by the admin Audit Log page.
model AuditLog {
id String @id @default(uuid())
createdAt DateTime @default(now())
userId String?
email String?
roleId Int?
roleName String?
page String
action String
entity String?
entityId String?
before Json?
after Json?
ip String?
@@index([createdAt])
@@index([roleId])
@@index([action])
@@index([page])
@@map("AuditLog")
}