-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.prisma
50 lines (41 loc) · 1.04 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
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
}
// Person
model Person {
id Int @id @default(autoincrement())
name String @db.VarChar(50)
email String @unique
sex String?
age Int?
birthday DateTime
profession String @default("Developer")
password String
company Company? @relation(fields: [companyId], references: [id])
hobbies Hobby[]
createdAt DateTime @default(now())
companyId Int
}
// Companies
model Company {
id Int @id @default(autoincrement())
name String @db.VarChar(50)
Person Person[]
}
// Hobbies
model Hobby {
id Int @id @default(autoincrement())
name String @db.VarChar(50)
category HobbiesCategory? @relation(fields: [categoryId], references: [id])
categoryId Int?
Person Person[]
}
model HobbiesCategory {
id Int @id @default(autoincrement())
name String @db.VarChar(50)
Hobby Hobby[]
}