aboutsummaryrefslogtreecommitdiffstats
path: root/backend/schema.prisma
blob: 49dea0776c5b59bc419b6f63aab5e63d1edc9d2d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
generator client {
  provider = "prisma-client-js"
}

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

model User {
  id       Int       @id @default(autoincrement())
  username String    @unique
  password String
  salt     String
  email    String    @unique
  sessions Session[]
  scores Score[]
}

model Session {
  id        String   @id @default(cuid())
  userId    Int
  user      User     @relation(fields: [userId], references: [id], onDelete: Cascade)
  createdAt DateTime @default(now())
  expiresAt DateTime
}

model Game {
  internalName   String  @id
  formattedName  String  @unique
  description    String
  scores Score[]
}

model Score {
  id     Int  @id @default(autoincrement())
  gameInternalName String
  userId Int
  timestamp Int //in UNIX milliseconds
  data   Json
  game   Game @relation(fields: [gameInternalName], references: [internalName])
  user   User @relation(fields: [userId], references: [id])
}
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage