2025-05-17 12:39:56 +02:00
|
|
|
// 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"
|
|
|
|
|
output = "./generated/prisma"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
datasource db {
|
|
|
|
|
provider = "postgresql"
|
|
|
|
|
url = env("DATABASE_URL")
|
|
|
|
|
}
|
2025-05-17 13:56:57 +02:00
|
|
|
|
|
|
|
|
model User {
|
|
|
|
|
id String @id @default(cuid())
|
|
|
|
|
username String @unique
|
|
|
|
|
name String
|
|
|
|
|
email String @unique
|
|
|
|
|
password String
|
|
|
|
|
lastLogin DateTime?
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
|
|
|
|
|
@@map("users")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model Site {
|
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
|
name String
|
|
|
|
|
description String?
|
|
|
|
|
networks Network[]
|
|
|
|
|
|
|
|
|
|
@@map("sites")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model Network {
|
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
|
site Site @relation(fields: [siteId], references: [id], onDelete: Cascade)
|
|
|
|
|
siteId Int
|
|
|
|
|
name String
|
|
|
|
|
ipv4Subnet String?
|
|
|
|
|
ipv6Subnet String?
|
|
|
|
|
gateway String?
|
|
|
|
|
servers Server[]
|
|
|
|
|
|
|
|
|
|
@@map("networks")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model Server {
|
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
|
network Network @relation(fields: [networkId], references: [id], onDelete: Cascade)
|
|
|
|
|
networkId Int
|
|
|
|
|
name String
|
|
|
|
|
description String?
|
|
|
|
|
icon String?
|
|
|
|
|
ipv4Address String?
|
|
|
|
|
osDetails String?
|
|
|
|
|
cpuDetails String?
|
|
|
|
|
gpuDetails String?
|
|
|
|
|
memoryDetails String?
|
|
|
|
|
storageDetails String?
|
|
|
|
|
managementUrl String?
|
|
|
|
|
monitoring Boolean @default(false)
|
|
|
|
|
monitoringUrl String?
|
|
|
|
|
monitoringData ServerMonitoring[]
|
|
|
|
|
applications Application[]
|
|
|
|
|
|
|
|
|
|
@@map("servers")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model ServerMonitoring {
|
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
|
server Server @relation(fields: [serverId], references: [id], onDelete: Cascade)
|
|
|
|
|
serverId Int
|
2025-05-21 22:52:32 +02:00
|
|
|
cpuPercentUsage Float
|
|
|
|
|
gpuPercentUsage Float
|
|
|
|
|
memoryUsage Float
|
|
|
|
|
memoryPercentUsage Float
|
2025-05-17 13:56:57 +02:00
|
|
|
diskUsage Float
|
2025-05-21 22:52:32 +02:00
|
|
|
diskPercentUsage Float
|
2025-05-17 13:56:57 +02:00
|
|
|
temperature Float
|
|
|
|
|
online Boolean
|
|
|
|
|
uptimeSeconds Int
|
|
|
|
|
timestamp DateTime @default(now())
|
|
|
|
|
|
|
|
|
|
@@index([serverId, timestamp])
|
|
|
|
|
@@index([online])
|
|
|
|
|
|
|
|
|
|
@@map("server_monitoring")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model Application {
|
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
|
server Server @relation(fields: [serverId], references: [id], onDelete: Cascade)
|
|
|
|
|
serverId Int
|
|
|
|
|
name String
|
|
|
|
|
description String?
|
|
|
|
|
icon String?
|
|
|
|
|
url String?
|
|
|
|
|
monitoring Boolean @default(false)
|
|
|
|
|
monitoringData ApplicationMonitoring[]
|
|
|
|
|
|
|
|
|
|
@@map("applications")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model ApplicationMonitoring {
|
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
|
application Application @relation(fields: [applicationId], references: [id], onDelete: Cascade)
|
|
|
|
|
applicationId Int
|
|
|
|
|
online Boolean
|
|
|
|
|
latency Float
|
|
|
|
|
timestamp DateTime @default(now())
|
|
|
|
|
|
|
|
|
|
@@index([applicationId, timestamp])
|
|
|
|
|
@@index([online])
|
|
|
|
|
|
|
|
|
|
@@map("application_monitoring")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model ServerMonitoringNotification {
|
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
|
statusChange Boolean
|
|
|
|
|
cpuLimit Float
|
|
|
|
|
gpuLimit Float
|
|
|
|
|
memoryLimit Float
|
|
|
|
|
diskLimit Float
|
|
|
|
|
temperatureLimit Float
|
2025-05-25 22:45:35 +02:00
|
|
|
notificationText String
|
2025-05-17 13:56:57 +02:00
|
|
|
|
|
|
|
|
@@map("server_monitoring_notifications")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model ApplicationMonitoringNotification {
|
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
|
statusChange Boolean
|
|
|
|
|
latencyLimit Float
|
2025-05-25 22:45:35 +02:00
|
|
|
notificationText String
|
2025-05-17 13:56:57 +02:00
|
|
|
|
|
|
|
|
@@map("application_monitoring_notifications")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model NotificationProvider {
|
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
|
name String
|
|
|
|
|
type NotificationType
|
|
|
|
|
config Json
|
2025-05-24 13:07:18 +02:00
|
|
|
tests NotificationTest[]
|
2025-05-17 13:56:57 +02:00
|
|
|
|
|
|
|
|
@@map("notification_providers")
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-24 13:07:18 +02:00
|
|
|
model NotificationTest {
|
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
|
notificationProvider NotificationProvider @relation(fields: [notificationProviderId], references: [id], onDelete: Cascade)
|
|
|
|
|
notificationProviderId Int
|
2025-05-25 15:42:08 +02:00
|
|
|
sent Boolean @default(false)
|
|
|
|
|
success Boolean?
|
2025-05-24 13:07:18 +02:00
|
|
|
|
|
|
|
|
@@map("notification_tests")
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-17 13:56:57 +02:00
|
|
|
enum NotificationType {
|
|
|
|
|
TELEGRAM
|
2025-05-25 14:14:26 +02:00
|
|
|
NTFY
|
|
|
|
|
SMTP
|
2025-05-17 13:56:57 +02:00
|
|
|
}
|