-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.prisma
111 lines (91 loc) · 2.68 KB
/
schema.prisma
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
datasource db {
provider = "mysql"
url = env("DATABASE_URL")
shadowDatabaseUrl = env("SHADOW_DATABASE_URL")
referentialIntegrity = "prisma"
}
generator client {
provider = "prisma-client-js"
previewFeatures = ["referentialIntegrity"]
}
generator dbml {
provider = "prisma-dbml-generator"
}
// -----------------------------------------------------------------------------
// These tables are required by next-auth
// https://next-auth.js.org/v3/adapters/prisma#setup
model Account {
id String @id @default(cuid())
userId String
providerType String
providerId String
providerAccountId String
refreshToken String?
accessToken String?
accessTokenExpires DateTime?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
user User @relation(fields: [userId], references: [id])
@@unique([providerId, providerAccountId])
}
model Session {
id String @id @default(cuid())
userId String
expires DateTime
sessionToken String @unique
accessToken String @unique
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
user User @relation(fields: [userId], references: [id])
}
model User {
id String @id @default(cuid())
name String?
email String? @unique
emailVerified DateTime?
image String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
interestedTags Tag[]
accounts Account[]
sessions Session[]
posts Post[]
roles Roles[]
}
model VerificationRequest {
id String @id @default(cuid())
identifier String
token String @unique
expires DateTime
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@unique([identifier, token])
}
// -----------------------------------------------------------------------------
// A user has a post which can have tags
model Post {
id String @id @default(cuid())
tweetId String @unique
author User @relation(fields: [authorId], references: [id])
authorId String
tags Tag[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
// tags can belong to many posts
model Tag {
id String @id @default(cuid())
name String
posts Post[]
interestedUsers User[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model Roles {
id String @id @default(cuid())
name String
discordId String @unique // Role ID in discord
users User[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}