Files
wled-controller/backend/prisma/schema.prisma
2025-12-21 16:54:13 +00:00

71 lines
2.0 KiB
Plaintext

generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "sqlite"
url = env("DATABASE_URL")
}
model Device {
id String @id @default(uuid())
name String
ipAddress String
port Int @default(80)
enabled Boolean @default(true)
lastSeenAt DateTime?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
groups GroupDevice[]
}
model Group {
id String @id @default(uuid())
name String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
devices GroupDevice[]
schedules Schedule[]
}
model GroupDevice {
groupId String
deviceId String
group Group @relation(fields: [groupId], references: [id], onDelete: Cascade)
device Device @relation(fields: [deviceId], references: [id], onDelete: Cascade)
@@id([groupId, deviceId])
}
model Schedule {
id String @id @default(uuid())
name String
groupId String
type String // 'PRESET' | 'PLAYLIST'
cronExpression String
endCronExpression String? // Optional: turn off lights at this time
timezone String @default("Europe/London")
enabled Boolean @default(true)
actionPayload String // JSON string
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
group Group @relation(fields: [groupId], references: [id])
}
model QuickAction {
id String @id @default(uuid())
name String
icon String? // Optional icon/emoji
groupId String? // Optional: if action targets a group
deviceId String? // Optional: if action targets a device
actionType String // 'PRESET' | 'PLAYLIST' | 'TURN_ON' | 'TURN_OFF' | 'BRIGHTNESS'
actionPayload String // JSON string
order Int @default(0) // For sorting
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}