-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.prisma
89 lines (77 loc) · 2.49 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
// 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"
previewFeatures = ["multiSchema"]
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
shadowDatabaseUrl = env("SHADOW_DATABASE_URL")
schemas = ["public", "saas"]
// Can't use same values for url and shadowDatabaseUrl
}
model Profile {
id Int @id @default(autoincrement())
user_uid String @unique
email String @unique
display_name String?
bio String?
first_name String?
last_name String?
dob DateTime?
profile_location String?
role ROLE @default(USER)
notes Note[]
account Account?
created_at DateTime @default(now())
updated_at DateTime @default(now())
@@map("profile")
@@schema("saas")
}
model Account {
id Int @id @default(autoincrement())
profile Profile @relation(fields: [profile_id], references: [id])
profile_id Int @unique
plan Plan @relation(fields: [plan_id], references: [id])
plan_id Int @default(1)
stripe_subscription_id String?
stripe_customer_id String?
current_period_ends DateTime?
created_at DateTime @default(now())
updated_at DateTime @default(now())
@@map("account")
@@schema("saas")
}
model Note {
id Int @id @default(autoincrement())
title String
content String
Profile Profile @relation(fields: [profile_id], references: [id])
profile_id Int
created_at DateTime @default(now())
updated_at DateTime @default(now())
@@map("note")
@@schema("saas")
}
model Plan {
id Int @id @default(autoincrement())
name String @unique
audience String
description String
features String[]
featured Boolean @default(false)
price Int
accounts Account[]
max_notes Int @default(100)
stripe_product_id String?
created_at DateTime @default(now())
updated_at DateTime @default(now())
@@map("plan")
@@schema("saas")
}
enum ROLE {
ADMIN
USER
@@schema("saas")
}