mirror of
https://github.com/crocofied/CoreControl.git
synced 2025-12-18 07:56:57 +00:00
266 lines
7.4 KiB
Plaintext
266 lines
7.4 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"
|
|
output = "./generated/prisma"
|
|
binaryTargets = ["native", "windows"]
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
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[]
|
|
monitoringSettings ServerMonitoringSettings[]
|
|
virtualMachines VirtualMachine[]
|
|
|
|
@@map("servers")
|
|
}
|
|
|
|
model VirtualMachine {
|
|
id Int @id @default(autoincrement())
|
|
name String
|
|
description String?
|
|
server Server @relation(fields: [serverId], references: [id], onDelete: Cascade)
|
|
serverId Int
|
|
icon String?
|
|
ipv4Address String?
|
|
osDetails String?
|
|
cpuDetails String?
|
|
gpuDetails String?
|
|
memoryDetails String?
|
|
storageDetails String?
|
|
managementUrl String?
|
|
monitoring Boolean @default(false)
|
|
monitoringUrl String?
|
|
monitoringSettings ServerMonitoringSettings[]
|
|
monitoringData VirtualMachineMonitoring[]
|
|
|
|
@@map("virtual_machines")
|
|
}
|
|
|
|
model ServerMonitoring {
|
|
id Int @id @default(autoincrement())
|
|
server Server @relation(fields: [serverId], references: [id], onDelete: Cascade)
|
|
serverId Int
|
|
cpuPercentUsage Float
|
|
gpuPercentUsage Float
|
|
memoryUsage Float
|
|
memoryPercentUsage Float
|
|
diskUsage Float
|
|
diskPercentUsage Float
|
|
temperature Float
|
|
online Boolean
|
|
uptimeSeconds Int
|
|
timestamp DateTime @default(now())
|
|
|
|
@@index([serverId, timestamp])
|
|
@@index([online])
|
|
|
|
@@map("server_monitoring")
|
|
}
|
|
|
|
model VirtualMachineMonitoring {
|
|
id Int @id @default(autoincrement())
|
|
virtualMachine VirtualMachine @relation(fields: [virtualMachineId], references: [id], onDelete: Cascade)
|
|
virtualMachineId Int
|
|
cpuPercentUsage Float
|
|
gpuPercentUsage Float
|
|
memoryUsage Float
|
|
memoryPercentUsage Float
|
|
diskUsage Float
|
|
diskPercentUsage Float
|
|
online Boolean
|
|
uptimeSeconds Int
|
|
timestamp DateTime @default(now())
|
|
|
|
@@index([virtualMachineId, timestamp])
|
|
@@index([online])
|
|
|
|
@@map("virtual_machine_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[]
|
|
monitoringSettings ApplicationMonitoringSettings[]
|
|
|
|
@@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())
|
|
enabled Boolean @default(false)
|
|
statusChange Boolean
|
|
cpuLimit Float
|
|
gpuLimit Float
|
|
memoryLimit Float
|
|
diskLimit Float
|
|
temperatureLimit Float
|
|
notificationTextStatus String
|
|
notificationTextCpu String
|
|
notificationTextGpu String
|
|
notificationTextMemory String
|
|
notificationTextDisk String
|
|
notificationTextTemperature String
|
|
notificationCpu Boolean
|
|
notificationGpu Boolean
|
|
notificationMemory Boolean
|
|
notificationDisk Boolean
|
|
notificationTemperature Boolean
|
|
|
|
@@map("server_monitoring_notifications")
|
|
}
|
|
|
|
model ApplicationMonitoringNotification {
|
|
id Int @id @default(autoincrement())
|
|
enabled Boolean @default(false)
|
|
statusChange Boolean
|
|
latencyLimit Float
|
|
notificationTextStatus String
|
|
notificationTextLatency String
|
|
notificationLatency Boolean
|
|
|
|
@@map("application_monitoring_notifications")
|
|
}
|
|
|
|
model NotificationProvider {
|
|
id Int @id @default(autoincrement())
|
|
name String
|
|
type NotificationType
|
|
config Json
|
|
tests NotificationTest[]
|
|
|
|
@@map("notification_providers")
|
|
}
|
|
|
|
model NotificationTest {
|
|
id Int @id @default(autoincrement())
|
|
notificationProvider NotificationProvider @relation(fields: [notificationProviderId], references: [id], onDelete: Cascade)
|
|
notificationProviderId Int
|
|
sent Boolean @default(false)
|
|
success Boolean?
|
|
|
|
@@map("notification_tests")
|
|
}
|
|
|
|
enum NotificationType {
|
|
TELEGRAM
|
|
NTFY
|
|
SMTP
|
|
}
|
|
|
|
model GeneralServerMonitoringSettings {
|
|
id Int @id @default(autoincrement())
|
|
frequency Int
|
|
checksUntilOffline Int
|
|
serverSettings ServerMonitoringSettings[]
|
|
|
|
@@map("general_server_monitoring_settings")
|
|
}
|
|
|
|
model GeneralApplicationMonitoringSettings {
|
|
id Int @id @default(autoincrement())
|
|
frequency Int
|
|
checksUntilOffline Int
|
|
applicationSettings ApplicationMonitoringSettings[]
|
|
|
|
@@map("general_application_monitoring_settings")
|
|
}
|
|
|
|
model ServerMonitoringSettings {
|
|
id Int @id @default(autoincrement())
|
|
server Server @relation(fields: [serverId], references: [id], onDelete: Cascade)
|
|
serverId Int
|
|
virtualMachine VirtualMachine @relation(fields: [virtualMachineId], references: [id], onDelete: Cascade)
|
|
virtualMachineId Int
|
|
generalSettings GeneralServerMonitoringSettings @relation(fields: [generalSettingsId], references: [id], onDelete: Cascade)
|
|
generalSettingsId Int
|
|
}
|
|
|
|
model ApplicationMonitoringSettings {
|
|
id Int @id @default(autoincrement())
|
|
application Application @relation(fields: [applicationId], references: [id], onDelete: Cascade)
|
|
applicationId Int
|
|
generalSettings GeneralApplicationMonitoringSettings @relation(fields: [generalSettingsId], references: [id], onDelete: Cascade)
|
|
generalSettingsId Int
|
|
} |