2023-12-08 12:26:08 +00:00
|
|
|
generator client {
|
2023-12-26 01:40:37 +00:00
|
|
|
provider = "cargo prisma"
|
|
|
|
output = "../backend/src/prisma.rs"
|
2023-12-08 12:26:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
datasource db {
|
|
|
|
provider = "postgresql"
|
|
|
|
url = env("DATABASE_URL")
|
|
|
|
}
|
|
|
|
|
|
|
|
model Universe {
|
|
|
|
id String @id @default(uuid())
|
|
|
|
|
|
|
|
config Json
|
|
|
|
|
2023-12-08 23:32:11 +00:00
|
|
|
players Player[]
|
|
|
|
empires Empire[]
|
|
|
|
starSystems StarSystem[]
|
|
|
|
planets Planet[]
|
|
|
|
Fleet Fleet[]
|
|
|
|
StarSystemEdges StarSystemEdges[]
|
2023-12-08 12:26:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
model User {
|
2023-12-08 23:32:11 +00:00
|
|
|
id String @id @default(uuid())
|
|
|
|
email String? @unique
|
|
|
|
emailVerified DateTime?
|
|
|
|
name String
|
|
|
|
image String?
|
|
|
|
|
|
|
|
accounts Account[]
|
|
|
|
sessions Session[]
|
|
|
|
}
|
|
|
|
|
|
|
|
model Player {
|
|
|
|
id String @id @default(uuid())
|
2023-12-08 12:26:08 +00:00
|
|
|
|
|
|
|
universeId String
|
|
|
|
universe Universe @relation(fields: [universeId], references: [id])
|
|
|
|
|
|
|
|
empire Empire?
|
|
|
|
}
|
|
|
|
|
|
|
|
model Empire {
|
|
|
|
id String @id @default(uuid())
|
|
|
|
|
2023-12-08 23:32:11 +00:00
|
|
|
universeId String
|
|
|
|
universe Universe @relation(fields: [universeId], references: [id])
|
|
|
|
|
2023-12-08 12:26:08 +00:00
|
|
|
name String
|
|
|
|
color String
|
|
|
|
|
2023-12-08 23:32:11 +00:00
|
|
|
playerId String? @unique
|
|
|
|
player Player? @relation(fields: [playerId], references: [id])
|
|
|
|
}
|
|
|
|
|
|
|
|
model StarSystem {
|
2023-12-30 05:40:38 +00:00
|
|
|
id String @id @default(uuid())
|
2023-12-08 23:32:11 +00:00
|
|
|
universeId String
|
|
|
|
universe Universe @relation(fields: [universeId], references: [id])
|
|
|
|
|
2023-12-30 05:40:38 +00:00
|
|
|
coordX Float
|
|
|
|
coordY Float
|
2023-12-08 23:32:11 +00:00
|
|
|
|
|
|
|
inbound StarSystemEdges[] @relation("inbound")
|
|
|
|
outbound StarSystemEdges[] @relation("outbound")
|
|
|
|
}
|
|
|
|
|
|
|
|
model StarSystemEdges {
|
|
|
|
universeId String
|
|
|
|
universe Universe @relation(fields: [universeId], references: [id])
|
|
|
|
|
2023-12-30 05:40:38 +00:00
|
|
|
fromSystemId String
|
|
|
|
from StarSystem @relation(fields: [fromSystemId], references: [id], name: "outbound")
|
2023-12-08 23:32:11 +00:00
|
|
|
|
2023-12-30 05:40:38 +00:00
|
|
|
toSystemId String
|
|
|
|
to StarSystem @relation(fields: [toSystemId], references: [id], name: "inbound")
|
2023-12-08 23:32:11 +00:00
|
|
|
|
2023-12-30 05:40:38 +00:00
|
|
|
@@id([universeId, fromSystemId, toSystemId])
|
2023-12-08 23:32:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
model Planet {
|
|
|
|
id String @id @default(uuid())
|
|
|
|
|
|
|
|
universeId String
|
|
|
|
universe Universe @relation(fields: [universeId], references: [id])
|
|
|
|
}
|
|
|
|
|
|
|
|
model Fleet {
|
|
|
|
id String @id @default(uuid())
|
|
|
|
|
|
|
|
universeId String
|
|
|
|
universe Universe @relation(fields: [universeId], references: [id])
|
|
|
|
}
|
|
|
|
|
|
|
|
model Technology {
|
|
|
|
name String @id
|
|
|
|
description String
|
|
|
|
effects Json
|
|
|
|
}
|
|
|
|
|
|
|
|
// SvelteKit Auth
|
|
|
|
|
|
|
|
model Account {
|
|
|
|
id String @id @default(cuid())
|
|
|
|
userId String
|
|
|
|
type String
|
|
|
|
provider String
|
|
|
|
providerAccountId String
|
|
|
|
refresh_token String? @db.Text
|
|
|
|
access_token String? @db.Text
|
|
|
|
expires_at Int?
|
|
|
|
token_type String?
|
|
|
|
scope String?
|
|
|
|
id_token String? @db.Text
|
|
|
|
session_state String?
|
|
|
|
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
|
|
|
|
@@unique([provider, providerAccountId])
|
|
|
|
}
|
|
|
|
|
|
|
|
model Session {
|
|
|
|
id String @id @default(cuid())
|
|
|
|
sessionToken String @unique
|
|
|
|
userId String
|
|
|
|
expires DateTime
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
}
|
|
|
|
|
|
|
|
model VerificationToken {
|
|
|
|
identifier String
|
|
|
|
token String @unique
|
|
|
|
expires DateTime
|
|
|
|
|
|
|
|
@@unique([identifier, token])
|
2023-12-08 12:26:08 +00:00
|
|
|
}
|