-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrealworld.prisma
63 lines (56 loc) · 1.82 KB
/
realworld.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
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
datasource db {
provider = "sqlite"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
}
model User {
bio String?
email String @unique
id Int @id @default(autoincrement())
image String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
name String?
hashedPassword String?
username String? @unique
articles Article[] @relation("UserArticles")
favorites Article[] @relation("UserFavorites", references: [id])
comments Comment[] @relation("UserComments")
followedBy User[] @relation("UserFollows", references: [id])
following User[] @relation("UserFollows", references: [id])
role String @default("USER")
//tokens Token[]
//sessions Session[]
}
model Article {
id Int @default(autoincrement()) @id
slug String @unique
title String
description String
body String
createdAt DateTime @default(now())
updatedAt DateTime @default(now())
tagList String
author User @relation("UserArticles", fields: [authorId], references: [id])
authorId Int
favoritedBy User[] @relation("UserFavorites", references: [id])
comments Comment[]
}
model Comment {
id Int @default(autoincrement()) @id
createdAt DateTime @default(now())
updatedAt DateTime @default(now())
body String
article Article @relation(fields: [articleId], references: [id])
articleId Int
author User @relation("UserComments", fields: [authorId], references: [id])
authorId Int
}
model Tag {
id Int @default(autoincrement()) @id
name String @unique
}