mirror of
https://github.com/biersoeckli/QuickStack.git
synced 2026-02-11 05:59:23 -06:00
328 lines
9.6 KiB
Plaintext
328 lines
9.6 KiB
Plaintext
// This is your Prisma schema file,
|
|
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
|
|
|
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
|
|
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
|
|
|
|
generator client {
|
|
provider = "prisma-client-js" // TODO: Upgrade to use native js client in prisma 7
|
|
}
|
|
|
|
generator zod {
|
|
provider = "zod-prisma"
|
|
output = "../src/shared/model/generated-zod" // (default) the directory where generated zod schemas will be saved
|
|
|
|
relationModel = true // (default) Create and export both plain and related models.
|
|
// relationModel = "default" // Do not export model without relations.
|
|
// relationModel = false // Do not generate related model
|
|
|
|
modelCase = "PascalCase" // (default) Output models using pascal case (ex. UserModel, PostModel)
|
|
|
|
modelSuffix = "Model" // (default) Suffix to apply to your prisma models when naming Zod schemas
|
|
|
|
// useDecimalJs = false // (default) represent the prisma Decimal type using as a JS number
|
|
useDecimalJs = true // represent the prisma Decimal type using Decimal.js (as Prisma does)
|
|
|
|
imports = null // (default) will import the referenced file in generated schemas to be used via imports.someExportedVariable
|
|
|
|
// https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-by-null-values
|
|
prismaJsonNullability = true // (default) uses prisma's scheme for JSON field nullability
|
|
// prismaJsonNullability = false // allows null assignment to optional JSON fields
|
|
}
|
|
|
|
datasource db {
|
|
provider = "sqlite"
|
|
}
|
|
|
|
// *** The following code is for the default NextAuth.js schema
|
|
|
|
model Account {
|
|
userId String
|
|
type String
|
|
provider String
|
|
providerAccountId String
|
|
refresh_token String?
|
|
access_token String?
|
|
expires_at Int?
|
|
token_type String?
|
|
scope String?
|
|
id_token String?
|
|
session_state String?
|
|
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
@@id([provider, providerAccountId])
|
|
}
|
|
|
|
model Session {
|
|
sessionToken String @unique
|
|
userId String
|
|
expires DateTime
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
}
|
|
|
|
model User {
|
|
id String @id @default(cuid())
|
|
name String?
|
|
email String @unique
|
|
emailVerified DateTime?
|
|
password String
|
|
twoFaSecret String?
|
|
twoFaEnabled Boolean @default(false)
|
|
image String?
|
|
|
|
userGroupId String?
|
|
userGroup UserGroup? @relation(fields: [userGroupId], references: [id])
|
|
|
|
accounts Account[]
|
|
sessions Session[]
|
|
// Optional for WebAuthn support
|
|
Authenticator Authenticator[]
|
|
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
}
|
|
|
|
model VerificationToken {
|
|
identifier String
|
|
token String
|
|
expires DateTime
|
|
|
|
@@id([identifier, token])
|
|
}
|
|
|
|
// Optional for WebAuthn support
|
|
|
|
model Authenticator {
|
|
credentialID String @unique
|
|
userId String
|
|
providerAccountId String
|
|
credentialPublicKey String
|
|
counter Int
|
|
credentialDeviceType String
|
|
credentialBackedUp Boolean
|
|
transports String?
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
@@id([userId, credentialID])
|
|
}
|
|
|
|
// *** FROM HERE CUSTOM CLASSES
|
|
|
|
model UserGroup {
|
|
id String @id @default(uuid())
|
|
name String @unique
|
|
description String?
|
|
canAccessBackups Boolean @default(false)
|
|
|
|
users User[]
|
|
roleProjectPermissions RoleProjectPermission[]
|
|
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
}
|
|
|
|
model RoleProjectPermission {
|
|
id String @id @default(uuid())
|
|
userGroup UserGroup @relation(fields: [userGroupId], references: [id], onDelete: Cascade)
|
|
userGroupId String
|
|
project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
|
|
projectId String
|
|
createApps Boolean @default(false)
|
|
deleteApps Boolean @default(false)
|
|
writeApps Boolean @default(false)
|
|
readApps Boolean @default(false)
|
|
|
|
roleAppPermissions RoleAppPermission[]
|
|
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
@@unique([userGroupId, projectId])
|
|
}
|
|
|
|
model RoleAppPermission {
|
|
id String @id @default(uuid())
|
|
app App @relation(fields: [appId], references: [id], onDelete: Cascade)
|
|
appId String
|
|
permission String // READ, READWRITE
|
|
roleProjectPermission RoleProjectPermission? @relation(fields: [roleProjectPermissionId], references: [id])
|
|
roleProjectPermissionId String?
|
|
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
@@unique([roleProjectPermissionId, appId])
|
|
}
|
|
|
|
model Project {
|
|
id String @id @default(uuid())
|
|
name String
|
|
apps App[]
|
|
roleProjectPermissions RoleProjectPermission[]
|
|
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
}
|
|
|
|
model App {
|
|
id String @id @default(uuid())
|
|
name String
|
|
appType String @default("APP") // APP, POSTGRES, MYSQL, MONGO
|
|
projectId String
|
|
project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
|
|
sourceType String @default("GIT") // GIT, CONTAINER
|
|
|
|
containerImageSource String?
|
|
containerRegistryUsername String?
|
|
containerRegistryPassword String?
|
|
|
|
gitUrl String?
|
|
gitBranch String?
|
|
gitUsername String?
|
|
gitToken String?
|
|
dockerfilePath String @default("./Dockerfile")
|
|
|
|
replicas Int @default(1)
|
|
envVars String @default("")
|
|
|
|
memoryReservation Int?
|
|
memoryLimit Int?
|
|
cpuReservation Int?
|
|
cpuLimit Int?
|
|
|
|
webhookId String?
|
|
|
|
ingressNetworkPolicy String @default("ALLOW_ALL") // ALLOW_ALL, NAMESPACE_ONLY, DENY_ALL, INTERNET_ONLY
|
|
egressNetworkPolicy String @default("ALLOW_ALL") // ALLOW_ALL, NAMESPACE_ONLY, DENY_ALL, INTERNET_ONLY
|
|
useNetworkPolicy Boolean @default(true)
|
|
|
|
// healthCheck startupProbe, readinessProbe, livenessProbe
|
|
healthChechHttpGetPath String?
|
|
healthCheckHttpScheme String? // HTTP, HTTPS
|
|
healthCheckHttpHeadersJson String? // JSON stringified key-value pairs
|
|
healthCheckHttpPort Int?
|
|
healthCheckPeriodSeconds Int @default(10)
|
|
healthCheckTimeoutSeconds Int @default(5)
|
|
|
|
healthCheckTcpPort Int?
|
|
|
|
appDomains AppDomain[]
|
|
appPorts AppPort[]
|
|
appVolumes AppVolume[]
|
|
appFileMounts AppFileMount[]
|
|
appBasicAuths AppBasicAuth[]
|
|
roleAppPermissions RoleAppPermission[]
|
|
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
}
|
|
|
|
model AppPort {
|
|
id String @id @default(uuid())
|
|
appId String
|
|
app App @relation(fields: [appId], references: [id], onDelete: Cascade)
|
|
port Int
|
|
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
@@unique([appId, port])
|
|
}
|
|
|
|
model AppDomain {
|
|
id String @id @default(uuid())
|
|
hostname String @unique
|
|
port Int
|
|
useSsl Boolean @default(true)
|
|
redirectHttps Boolean @default(true)
|
|
appId String
|
|
app App @relation(fields: [appId], references: [id], onDelete: Cascade)
|
|
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
}
|
|
|
|
model AppVolume {
|
|
id String @id @default(uuid())
|
|
containerMountPath String
|
|
size Int
|
|
accessMode String @default("rwo")
|
|
storageClassName String @default("longhorn")
|
|
appId String
|
|
app App @relation(fields: [appId], references: [id], onDelete: Cascade)
|
|
volumeBackups VolumeBackup[]
|
|
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
@@unique([appId, containerMountPath])
|
|
}
|
|
|
|
model AppFileMount {
|
|
id String @id @default(uuid())
|
|
containerMountPath String
|
|
content String
|
|
appId String
|
|
app App @relation(fields: [appId], references: [id], onDelete: Cascade)
|
|
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
@@unique([appId, containerMountPath])
|
|
}
|
|
|
|
model Parameter {
|
|
name String @id
|
|
value String
|
|
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
}
|
|
|
|
model S3Target {
|
|
id String @id @default(uuid())
|
|
name String
|
|
bucketName String
|
|
endpoint String
|
|
region String
|
|
accessKeyId String
|
|
secretKey String
|
|
volumeBackups VolumeBackup[]
|
|
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
}
|
|
|
|
model VolumeBackup {
|
|
id String @id @default(uuid())
|
|
volumeId String
|
|
volume AppVolume @relation(fields: [volumeId], references: [id], onDelete: Cascade)
|
|
targetId String
|
|
target S3Target @relation(fields: [targetId], references: [id], onDelete: Cascade)
|
|
cron String
|
|
retention Int
|
|
useDatabaseBackup Boolean @default(false) // decides wether backup whole volume or make a dump of the databse (only for database volumes)
|
|
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
}
|
|
|
|
model AppBasicAuth {
|
|
id String @id @default(uuid())
|
|
username String
|
|
password String
|
|
appId String
|
|
app App @relation(fields: [appId], references: [id], onDelete: Cascade)
|
|
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
}
|