-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.prisma
61 lines (50 loc) · 1.48 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
// Don't forget to tell Prisma about your edits to this file using
// `yarn rw prisma migrate dev` or `yarn rw prisma db push`.
// `migrate` is like committing while `push` is for prototyping.
// Read more about both here:
// https://www.prisma.io/docs/orm/prisma-migrate
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
binaryTargets = "native"
}
model User {
id String @id @default(cuid())
externalAuthProvider String @map(name: "external_auth_provider") @default("auth0")
externalAuthId String @map(name: "external_auth_id")
tabs Tab[]
tags Tag[]
}
model Tab {
id String @id @default(cuid())
title String?
url String
notes String?
createdAt DateTime? @map(name: "created_at") @default(now())
updatedAt DateTime? @map(name: "updated_at")
userId String @map(name: "user_id")
user User @relation(fields: [userId], references: [id])
tags TabTag[]
@@index([title])
@@index([updatedAt])
@@index([createdAt])
}
model Tag {
id String @id @default(cuid())
name String
userId String @map(name: "user_id")
user User @relation(fields: [userId], references: [id])
tabs TabTag[]
@@unique([name, userId])
}
model TabTag {
id String @id @default(cuid())
tabId String @map(name: "tab_id")
tagId String @map(name: "tag_id")
tab Tab @relation(fields: [tabId], references: [id])
tag Tag @relation(fields: [tagId], references: [id])
@@unique([tabId, tagId])
}