upd: database

This commit is contained in:
2026-04-06 17:24:28 +08:00
parent 12e65b33d3
commit e889a97e2a
2 changed files with 172 additions and 0 deletions

View File

@@ -12,6 +12,27 @@ enum Role {
USER
ADMIN
SUPER_ADMIN
DEVELOPER
}
enum App{
desa_plus
hipmi
}
enum BugSource{
QC
SYSTEM
USER
}
enum BugStatus{
OPEN
ON_HOLD
IN_PROGRESS
RESOLVED
RELEASED
CLOSED
}
model User {
@@ -20,10 +41,14 @@ model User {
email String @unique
password String
role Role @default(USER)
active Boolean @default(true)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
sessions Session[]
logs Log[]
bugs Bug[]
bugLogs BugLog[]
@@map("user")
}
@@ -40,3 +65,68 @@ model Session {
@@index([token])
@@map("session")
}
model Log {
id String @id @default(uuid())
userId String
type String
message String
createdAt DateTime @default(now())
user User @relation(fields: [userId], references: [id])
@@map("log")
}
model Bug {
id String @id @default(uuid())
userId String?
app App
affectedVersion String
device String
os String
status BugStatus
source BugSource
description String
stackTrace String?
fixedVersion String?
feedBack String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
user User? @relation(fields: [userId], references: [id])
images BugImage[]
logs BugLog[]
@@map("bug")
}
model BugImage {
id String @id @default(uuid())
bugId String
imageUrl String
createdAt DateTime @default(now())
bug Bug @relation(fields: [bugId], references: [id], onDelete: Cascade)
@@map("bug_image")
}
model BugLog {
id String @id @default(uuid())
bugId String
userId String
status BugStatus
description String
createdAt DateTime @default(now())
bug Bug @relation(fields: [bugId], references: [id], onDelete: Cascade)
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@map("bug_log")
}