From 183642805d947e8721b02cdfd3988b1b9d063f15 Mon Sep 17 00:00:00 2001 From: Rafi Arrafif Date: Mon, 25 May 2026 21:00:00 +0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=97=83=EF=B8=8F=20db:=20add=20comment=20a?= =?UTF-8?q?udit=20logs=20in=20schema?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- prisma/schema.prisma | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) 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") +} + /**