diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 289f8e7..1587e24 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -78,6 +78,13 @@ enum like_type { dislike } +enum audit_action { + delete + restore + edit + flag +} + /** @@ -125,6 +132,7 @@ model User { reviewed_video_services VideoServiceSubmission[] @relation("VideoServiceSubmissionReviewer") comments Comment[] comment_likes CommentLike[] + comment_audit_logs CommentAuditLog[] @@index([email]) @@index([username]) @@map("users") @@ -655,6 +663,7 @@ model Comment { user_id String @db.Uuid episode_id String @db.Uuid likes CommentLike[] + audit_logs CommentAuditLog[] @@map("comments") } @@ -670,6 +679,18 @@ model CommentLike { @@map("comment_likes") } +model CommentAuditLog { + id String @id @db.Uuid @default(uuid(7)) + comment Comment @relation(fields: [comment_id], references: [id]) + performed_by User @relation(fields: [performed_by_id], references: [id]) + action audit_action + created_at DateTime @default(now()) @db.Timestamptz() + + comment_id String @db.Uuid + performed_by_id String @db.Uuid + @@map("comment_audit_logs") +} + /**