-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathschema.prisma
36 lines (32 loc) · 921 Bytes
/
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
datasource db {
provider = "mongodb"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
}
model User {
id String @id @default(auto()) @map("_id") @db.ObjectId
email String @unique
password String
urls Url[] @relation("UserUrls")
sessions Session[]
}
model Session {
id String @id @default(auto()) @map("_id") @db.ObjectId
user User @relation(fields: [userId], references: [id])
sessionToken String @unique
userId String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model Url {
id String @id @default(auto()) @map("_id") @db.ObjectId
longUrl String
shortUrl String
deleted Boolean @default(false)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
user User? @relation("UserUrls", fields: [userId], references: [id])
userId String? @db.ObjectId
}