-
-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathschema.dbml
More file actions
57 lines (47 loc) · 1.16 KB
/
Copy pathschema.dbml
File metadata and controls
57 lines (47 loc) · 1.16 KB
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
//// ------------------------------------------------------
//// THIS FILE WAS AUTOMATICALLY GENERATED (DO NOT MODIFY)
//// ------------------------------------------------------
Table User {
id Int [pk, increment]
createdAt DateTime [default: `now()`, not null]
updatedAt DateTime [not null]
email String [unique, not null]
name String
posts Post [not null]
profile Profile
}
Table Profile {
id Int [pk, increment]
bio String
user User [not null]
userId Int [unique, not null]
Note: 'User profile'
}
Table Post {
id Int [pk, increment]
title String [not null, default: '']
content String
published Boolean [not null, default: false]
author User
authorId Int
categories Category [not null]
}
Table Category {
id Int [pk, increment]
name String [not null]
posts Post [not null]
}
Table Token {
id Int [pk, increment]
device String [not null]
operatingSystem String [not null]
indexes {
(device, operatingSystem) [unique]
}
}
Table CategoryToPost {
categoriesId Int [ref: > Category.id]
postsId Int [ref: > Post.id]
}
Ref: Profile.userId - User.id [delete: Cascade]
Ref: Post.authorId > User.id [delete: Set Null]