-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
schema.prisma
60 lines (53 loc) · 1.71 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
// 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 = "postgresql"
url = env("DATABASE_URL")
}
model User {
id String @id @default(nanoid(16))
username String @unique
email String @unique
password String
name String
verified Boolean @default(false)
settings Json @default("{}")
pastes Paste[]
AuthToken AuthToken[]
ResetToken ResetToken?
}
model AuthToken {
id String @id @default(nanoid(16))
createdAt DateTime @default(now())
expiresAt DateTime
token String @unique
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
}
model ResetToken {
id String @id @default(nanoid(16))
createdAt DateTime @default(now())
expiresAt DateTime
token String @unique
userId String @unique
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
}
model Paste {
id BigInt @id @default(autoincrement())
createdAt DateTime @default(now())
key String @unique @db.VarChar(20)
content String
encrypted Boolean @default(false)
passwordProtected Boolean @default(false)
initVector String? @unique @db.VarChar(64)
language String @default("plaintext") @db.VarChar(64)
expiresAt DateTime?
expiresCount Int?
readCount Int @default(0)
ownerId String?
owner User? @relation(fields: [ownerId], references: [id], onDelete: SetNull)
@@index([key])
}