-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprisma-v7-schema.prisma
More file actions
77 lines (69 loc) · 2.53 KB
/
Copy pathprisma-v7-schema.prisma
File metadata and controls
77 lines (69 loc) · 2.53 KB
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
generator client {
provider = "prisma-client-js"
engineType = "binary"
}
datasource db {
provider = "postgresql"
}
enum RecordingAccess {
FREE
SUBSCRIBER
}
model User {
id String @id @default(cuid())
clerkUserId String @unique
email String? @unique
name String?
imageUrl String?
stripeCustomerId String? @unique
freeTranscriptionCount Int @default(0)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
subscription Subscription?
recordings Recording[]
documents Document[]
}
model Subscription {
id String @id @default(cuid())
userId String @unique
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
stripeCustomerId String? @unique
stripeSubscriptionId String @unique
stripePriceId String?
status String
cancelAtPeriodEnd Boolean @default(false)
currentPeriodEnd DateTime?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model Recording {
id String @id @default(cuid())
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
title String
transcript String @db.Text
audioUrl String?
audioStoragePath String?
access RecordingAccess @default(SUBSCRIBER)
charCount Int @default(0)
wordCount Int @default(0)
createdAt DateTime @default(now())
document Document?
@@index([userId, createdAt])
}
model Document {
id String @id @default(cuid())
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
recordingId String? @unique
recording Recording? @relation(fields: [recordingId], references: [id], onDelete: SetNull)
title String
transcript String @db.Text
twitter String @db.Text
linkedin String @db.Text
summary String @db.Text
tone String @default("professional")
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([userId, createdAt])
}