1
0
forked from noxious/server
noxious_server/prisma/schema.prisma
2024-05-05 02:58:36 +02:00

45 lines
1.1 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"
}
datasource db {
provider = "mysql"
url = env("DATABASE_URL")
}
model User {
id Int @id @default(autoincrement())
username String @unique
password String
position_x Int?
position_y Int?
rotation Int?
mapId Int? @unique
map Map? @relation(fields: [mapId], references: [id])
chatlogs Chatlogs[]
}
model Map {
id Int @id @default(autoincrement())
name String
width Int
height Int
tiles Json
users User[] // One-to-many relation: A map can have multiple users
chatlogs Chatlogs[]
}
model Chatlogs {
id Int @id @default(autoincrement())
userId Int
message String
mapId Int
map Map @relation(fields: [mapId], references: [id])
user User @relation(fields: [userId], references: [id])
}