forked from noxious/server
48 lines
1.0 KiB
Plaintext
48 lines
1.0 KiB
Plaintext
// CHEAT SHEET
|
|
// 1. Create a new Prisma project
|
|
// npx prisma init
|
|
// 2. Create a new database schema
|
|
// npx prisma db push
|
|
// 3. Generate Prisma Client
|
|
// npx prisma generate
|
|
// 4. Create a new migration
|
|
// npx prisma migrate dev --name init
|
|
// 5. Apply the migration
|
|
// npx prisma migrate deploy
|
|
|
|
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
|
|
characters Character[]
|
|
}
|
|
|
|
model Character {
|
|
id Int @id @default(autoincrement())
|
|
name String
|
|
position_x Int
|
|
position_y Int
|
|
rotation Int
|
|
userId Int
|
|
user User @relation(fields: [userId], references: [id])
|
|
zoneId Int
|
|
zone Zone @relation(fields: [zoneId], references: [id])
|
|
}
|
|
|
|
model Zone {
|
|
id Int @id @default(autoincrement())
|
|
name String
|
|
width Int
|
|
height Int
|
|
tiles Json
|
|
characters Character[]
|
|
} |