panorama/prisma/schema.prisma

100 lines
1.9 KiB
Text
Raw Normal View History

2023-03-23 18:32:34 +00:00
generator client {
provider = "prisma-client-js"
binaryTargets = ["native"]
}
datasource db {
provider = "sqlite"
url = env("DATABASE_URL")
}
model Node {
id String @id @default(uuid())
label String?
implements NodeImplements[]
2023-03-30 03:30:17 +00:00
fromNodes Edge[] @relation(name: "fromNode")
toNodes Edge[] @relation(name: "toNode")
2023-03-30 01:56:52 +00:00
metadata NodeMeta[]
2023-03-23 18:32:34 +00:00
}
model Interface {
id String @id @default(uuid())
implementors NodeImplements[]
}
2023-03-30 03:30:17 +00:00
model Edge {
2023-03-31 21:31:41 +00:00
id String @id @default(uuid())
2023-03-23 18:32:34 +00:00
label String?
2023-03-31 21:31:41 +00:00
/// The app that created this edge
app App @relation(fields: [appId], references: [id])
appId String
appKey String
2023-03-23 18:32:34 +00:00
fromId String
fromNode Node @relation(name: "fromNode", fields: [fromId], references: [id])
toId String
toNode Node @relation(name: "toNode", fields: [toId], references: [id])
2023-03-30 03:30:17 +00:00
@@unique([fromId, toId])
2023-03-31 21:31:41 +00:00
@@index([appId, appKey])
2023-03-23 18:32:34 +00:00
}
2023-03-30 01:56:52 +00:00
model NodeMeta {
nodeId String
2023-04-19 01:44:44 +00:00
node Node @relation(fields: [nodeId], references: [id], onDelete: Cascade)
2023-03-30 01:56:52 +00:00
2023-03-31 21:31:41 +00:00
/// The app that created this metadata field
2023-03-30 01:56:52 +00:00
app App @relation(fields: [appId], references: [id])
2023-03-31 21:31:41 +00:00
appId String
appKey String
2023-03-30 01:56:52 +00:00
value Bytes
2023-03-31 21:31:41 +00:00
@@id([nodeId, appId, appKey])
@@index([appId, appKey])
2023-03-30 01:56:52 +00:00
}
2023-03-23 18:32:34 +00:00
model NodeImplements {
nodeId String
node Node @relation(fields: [nodeId], references: [id])
interfaceId String
interface Interface @relation(fields: [interfaceId], references: [id])
@@id([nodeId, interfaceId])
}
2023-03-30 01:56:52 +00:00
model App {
id String @id @default(uuid())
localName String @unique
title String
2023-04-18 07:38:22 +00:00
installed DateTime @default(now())
2023-03-30 01:56:52 +00:00
patterns Patterns[]
metaKeys NodeMeta[]
2023-03-31 21:31:41 +00:00
edges Edge[]
2023-03-30 01:56:52 +00:00
}
/// Regular expressions table
model Patterns {
id String @id @default(uuid())
pattern String
2023-03-31 21:31:41 +00:00
2023-03-30 03:30:17 +00:00
/// Pattern type, see docs for details
type String
2023-03-30 01:56:52 +00:00
appId String
app App @relation(fields: [appId], references: [id])
functionName String
}