forked from 47ng/prisma-field-encryption
-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.prisma
43 lines (38 loc) · 1.16 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
datasource db {
provider = "sqlite"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
previewFeatures = ["interactiveTransactions"]
output = "../src/tests/.generated/client"
}
// generator fieldEncryptionMigrations {
// provider = "prisma-field-encryption"
// output = "../src/tests/migrations"
// }
model User {
id Int @id @default(autoincrement())
email String @unique
name String? /// @encrypted
nameHash String? /// @encryption:hash(name)
posts Post[]
pinnedPost Post? @relation(fields: [pinnedPostId], references: [id], name: "pinnedPost")
pinnedPostId Int?
}
model Post {
id Int @id @default(autoincrement())
title String
content String? /// @encrypted
published Boolean @default(false)
author User? @relation(fields: [authorId], references: [id], onDelete: Cascade, onUpdate: Cascade)
authorId Int?
categories Category[]
havePinned User[] @relation("pinnedPost")
}
// Model without encrypted fields
model Category {
id Int @id @default(autoincrement())
name String
posts Post[]
}