first working release
This commit is contained in:
52
prisma/schema.prisma
Normal file
52
prisma/schema.prisma
Normal file
@@ -0,0 +1,52 @@
|
||||
// This is your Prisma schema file,
|
||||
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
||||
|
||||
// Get a free hosted Postgres database in seconds: `npx create-db`
|
||||
|
||||
generator client {
|
||||
provider = "prisma-client"
|
||||
output = "../src/generated/prisma"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "sqlite"
|
||||
}
|
||||
|
||||
// A physical location in the building (e.g., "Serverraum", "Wohnzimmer")
|
||||
model Location {
|
||||
id Int @id @default(autoincrement())
|
||||
name String
|
||||
description String? // Optional Markdown text
|
||||
|
||||
// A location can be the start OR end of many cables
|
||||
startCables Cable[] @relation("StartLocation")
|
||||
endCables Cable[] @relation("EndLocation")
|
||||
}
|
||||
|
||||
// A single cable run documented in the system
|
||||
model Cable {
|
||||
id Int @id @default(autoincrement())
|
||||
identifier String // e.g. "Kabel 01", "LAN-01"
|
||||
description String? // Short plain-text summary
|
||||
notes String? // Long-form Markdown notes
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
startLocationId Int
|
||||
endLocationId Int
|
||||
|
||||
startLocation Location @relation("StartLocation", fields: [startLocationId], references: [id])
|
||||
endLocation Location @relation("EndLocation", fields: [endLocationId], references: [id])
|
||||
|
||||
cores Core[] // One cable can have many cores/wires
|
||||
}
|
||||
|
||||
// A single wire/core within a cable (e.g., "Blau", "Rot/Weiß")
|
||||
model Core {
|
||||
id Int @id @default(autoincrement())
|
||||
color String // Color designation, e.g. "Blau", "Braun/Weiß"
|
||||
notes String? // Optional Markdown notes
|
||||
|
||||
cableId Int
|
||||
cable Cable @relation(fields: [cableId], references: [id], onDelete: Cascade)
|
||||
}
|
||||
Reference in New Issue
Block a user