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