File size: 2,120 Bytes
17aecfb
 
 
 
 
 
 
 
 
 
 
 
 
db78a09
 
 
 
 
 
 
db9bd2d
db78a09
 
 
 
eb29a95
 
 
d6da254
 
 
 
404baa5
d6da254
 
 
 
 
8a18175
eb29a95
 
 
d6da254
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3503213
 
d6da254
 
 
 
 
 
 
 
 
 
 
 
 
17aecfb
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema

generator client {
  provider = "prisma-client-js"
}

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

model Model {
  id              String    @id
  createdAt       DateTime  @default(now())
  image           String
  likes           Int?
  downloads       Int?
  instance_prompt String?
  isPublic        Boolean   @default(false)
  likes7d         Int?      @default(0)
  user            User?     @relation(fields: [userId], references: [sub])
  userId          String?
  gallery         Gallery[]
  comments        Comment[]
}

model Gallery {
  id        String     @id @default(uuid())
  createdAt DateTime   @default(now())
  prompt    String
  image     String
  isPublic  Boolean    @default(false)
  reactions Reaction[]
  model     Model      @relation(fields: [modelId], references: [id])
  modelId   String
  user      User?      @relation(fields: [userId], references: [sub])
  userId    String?
  comments  Comment[]
}

model Reaction {
  id        String   @id @default(uuid())
  createdAt DateTime @default(now())
  emoji     String
  user      User     @relation(fields: [userId], references: [sub])
  gallery   Gallery? @relation(fields: [galleryId], references: [id])
  userId    String
  galleryId String?
}

model Comment {
  id        String   @id @default(uuid())
  createdAt DateTime @default(now())
  text      String
  user      User     @relation(fields: [userId], references: [sub])
  userId    String
  model     Model?   @relation(fields: [modelId], references: [id])
  modelId   String?
  gallery   Gallery? @relation(fields: [galleryId], references: [id])
  galleryId String?
}

model User {
  id                 String     @id @default(uuid())
  createdAt          DateTime   @default(now())
  sub                String     @unique
  name               String
  preferred_username String     @unique
  picture            String?
  comments           Comment[]
  reactions          Reaction[]
  gallery            Gallery[]
  models             Model[]
}