This repository has been archived by the owner on Sep 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.prisma
86 lines (71 loc) · 2.39 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
// 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 Int @id @default(autoincrement())
supabase_uid String
email String
display_name String?
memberships Membership[]
@@map("users")
}
enum ACCOUNT_ACCESS {
READ_ONLY
READ_WRITE
ADMIN
OWNER
}
model Membership {
id Int @id @default(autoincrement())
user_id Int
account_id Int
account Account @relation(fields: [account_id], references: [id])
user User @relation(fields: [user_id], references: [id])
access ACCOUNT_ACCESS @default(READ_ONLY)
pending Boolean @default(false)
@@map("membership")
@@unique([user_id, account_id])
}
model Account {
id Int @id @default(autoincrement())
name String
current_period_ends DateTime @default(now())
features String[]
plan_id Int
plan Plan @relation(fields: [plan_id], references: [id])
plan_name String
members Membership[]
notes Note[]
max_notes Int @default(100)
stripe_subscription_id String?
stripe_customer_id String?
max_members Int @default(1)
join_password String @unique
ai_gen_max_pm Int @default(7)
ai_gen_count Int @default(0)
@@map("account")
}
model Plan {
id Int @id @default(autoincrement())
name String @unique
features String[]
accounts Account[]
max_notes Int @default(100)
stripe_product_id String?
max_members Int @default(1)
ai_gen_max_pm Int @default(7)
@@map("plan")
}
model Note {
id Int @id @default(autoincrement())
account_id Int?
account Account? @relation(fields: [account_id], references: [id])
note_text String
@@map("note")
}