Update schema.prisma
This commit is contained in:
+79
-86
@@ -11,27 +11,28 @@ datasource db {
|
||||
}
|
||||
|
||||
model User {
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
authentikId String? @unique
|
||||
authentikUserId String? @unique
|
||||
authentikSubject String? @unique
|
||||
username String? @db.VarChar(255) @unique
|
||||
email String? @db.VarChar(320) @unique
|
||||
name String? @db.VarChar(255)
|
||||
picture String?
|
||||
isActive Boolean @default(true)
|
||||
deletedAt DateTime?
|
||||
lastSeenAt DateTime?
|
||||
lastSyncedAt DateTime?
|
||||
syncStatus String?
|
||||
storageQuota BigInt? @default(10737418240)
|
||||
storageUsed BigInt? @default(0)
|
||||
metadata Json?
|
||||
userRoles UserRole[]
|
||||
auditLogs AuditLog[]
|
||||
lastGroupHash String? @db.Text
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
authentikId String? @unique
|
||||
authentikUserId String? @unique
|
||||
authentikSubject String? @unique
|
||||
username String? @unique @db.VarChar(255)
|
||||
email String? @unique @db.VarChar(320)
|
||||
name String? @db.VarChar(255)
|
||||
picture String?
|
||||
isActive Boolean @default(true)
|
||||
deletedAt DateTime?
|
||||
lastSeenAt DateTime?
|
||||
lastSyncedAt DateTime?
|
||||
syncStatus String?
|
||||
storageQuota BigInt? @default(10737418240)
|
||||
storageUsed BigInt? @default(0)
|
||||
metadata Json?
|
||||
userRoles UserRole[]
|
||||
auditLogs AuditLog[]
|
||||
mediaObjects MediaObject[]
|
||||
lastGroupHash String? @db.Text
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@index([authentikId])
|
||||
@@index([username])
|
||||
@@ -39,37 +40,37 @@ model User {
|
||||
}
|
||||
|
||||
model Role {
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
code String @unique @db.VarChar(100)
|
||||
name String @db.VarChar(255)
|
||||
displayName String? @db.VarChar(255)
|
||||
description String?
|
||||
isDefault Boolean @default(false)
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
code String @unique @db.VarChar(100)
|
||||
name String @db.VarChar(255)
|
||||
displayName String? @db.VarChar(255)
|
||||
description String?
|
||||
isDefault Boolean @default(false)
|
||||
rolePermissions RolePermission[]
|
||||
userRoles UserRole[]
|
||||
mappings AuthGroupRoleMapping[]
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
userRoles UserRole[]
|
||||
mappings AuthGroupRoleMapping[]
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
|
||||
model Permission {
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
code String @unique @db.VarChar(150)
|
||||
name String @db.VarChar(255)
|
||||
displayName String? @db.VarChar(255)
|
||||
description String?
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
code String @unique @db.VarChar(150)
|
||||
name String @db.VarChar(255)
|
||||
displayName String? @db.VarChar(255)
|
||||
description String?
|
||||
rolePermissions RolePermission[]
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
|
||||
model RolePermission {
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
role Role @relation(fields: [roleId], references: [id], onDelete: Cascade)
|
||||
roleId String @db.Uuid
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
role Role @relation(fields: [roleId], references: [id], onDelete: Cascade)
|
||||
roleId String @db.Uuid
|
||||
permission Permission @relation(fields: [permissionId], references: [id], onDelete: Cascade)
|
||||
permissionId String @db.Uuid
|
||||
createdAt DateTime @default(now())
|
||||
permissionId String @db.Uuid
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
@@unique([roleId, permissionId])
|
||||
@@index([roleId])
|
||||
@@ -82,14 +83,14 @@ enum UserRoleSource {
|
||||
}
|
||||
|
||||
model UserRole {
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
userId String @db.Uuid
|
||||
role Role @relation(fields: [roleId], references: [id], onDelete: Cascade)
|
||||
roleId String @db.Uuid
|
||||
source UserRoleSource @default(AUTHENTIK)
|
||||
syncedAt DateTime @default(now())
|
||||
createdAt DateTime @default(now())
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
userId String @db.Uuid
|
||||
role Role @relation(fields: [roleId], references: [id], onDelete: Cascade)
|
||||
roleId String @db.Uuid
|
||||
source UserRoleSource @default(AUTHENTIK)
|
||||
syncedAt DateTime @default(now())
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
@@unique([userId, roleId])
|
||||
@@index([userId])
|
||||
@@ -97,12 +98,12 @@ model UserRole {
|
||||
}
|
||||
|
||||
model AuthGroupRoleMapping {
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
authGroup String @db.VarChar(255)
|
||||
role Role @relation(fields: [roleId], references: [id], onDelete: Cascade)
|
||||
roleId String @db.Uuid
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
authGroup String @db.VarChar(255)
|
||||
role Role @relation(fields: [roleId], references: [id], onDelete: Cascade)
|
||||
roleId String @db.Uuid
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@index([authGroup])
|
||||
}
|
||||
@@ -122,40 +123,38 @@ model AuditLog {
|
||||
}
|
||||
|
||||
model ScheduledJob {
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
name String @db.VarChar(255)
|
||||
payload Json?
|
||||
cron String?
|
||||
runAt DateTime?
|
||||
status String @db.VarChar(50) @default("pending")
|
||||
attempts Int @default(0)
|
||||
lastRunAt DateTime?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
name String @db.VarChar(255)
|
||||
payload Json?
|
||||
cron String?
|
||||
runAt DateTime?
|
||||
status String @default("pending") @db.VarChar(50)
|
||||
attempts Int @default(0)
|
||||
lastRunAt DateTime?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@index([name])
|
||||
@@index([status])
|
||||
}
|
||||
|
||||
model MediaObject {
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
ownerUserId String? @db.Uuid
|
||||
owner User? @relation(fields: [ownerUserId], references: [id], onDelete: SetNull)
|
||||
storageKey String @db.VarChar(1024)
|
||||
filename String? @db.VarChar(1024)
|
||||
mimeType String? @db.VarChar(255)
|
||||
size BigInt?
|
||||
isPublic Boolean @default(false)
|
||||
metadata Json?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
ownerUserId String? @db.Uuid
|
||||
owner User? @relation(fields: [ownerUserId], references: [id], onDelete: SetNull)
|
||||
storageKey String @db.VarChar(1024)
|
||||
filename String? @db.VarChar(1024)
|
||||
mimeType String? @db.VarChar(255)
|
||||
size BigInt?
|
||||
isPublic Boolean @default(false)
|
||||
metadata Json?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@index([ownerUserId])
|
||||
@@index([storageKey])
|
||||
}
|
||||
|
||||
|
||||
|
||||
model Application {
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
code String @unique @db.VarChar(100)
|
||||
@@ -172,9 +171,3 @@ model Application {
|
||||
@@index([code])
|
||||
@@index([applicationsClaim])
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user