-
Notifications
You must be signed in to change notification settings - Fork 1
/
schema.dbml
107 lines (87 loc) · 2.17 KB
/
schema.dbml
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
table account {
userId varchar(255) [not null]
type varchar(255) [not null]
provider varchar(255) [not null]
providerAccountId varchar(255) [not null]
refresh_token varchar(255)
access_token varchar(255)
expires_at int
token_type varchar(255)
scope varchar(255)
id_token text
session_state varchar(255)
indexes {
(provider, providerAccountId) [pk]
userId [name: 'userId_idx']
}
}
table attachments {
id serial [pk, not null, increment]
url varchar(256) [not null]
secret_id int
}
table friendship {
user_id varchar(255) [not null]
friend_id varchar(255) [not null]
request_accepted boolean [not null, default: false]
indexes {
(user_id, friend_id) [pk]
}
}
table secrets {
id serial [pk, not null, increment]
title varchar(256) [not null]
shareable_url varchar(256) [not null, unique]
content text [not null]
revealing_date datetime [not null]
revealed boolean
encryption_type enum('RC4','DES','Rabbit','AES') [not null, default: 'RC4']
edited_at datetime
created_at datetime
was_edited boolean [default: false]
created_by_user_id varchar(256) [not null]
indexes {
revealed [name: 'revealed_idx']
created_by_user_id [name: 'created_by_idx']
}
}
table session {
sessionToken varchar(255) [pk, not null]
userId varchar(255) [not null]
expires timestamp [not null]
indexes {
userId [name: 'userId_idx']
}
}
table user {
id varchar(255) [pk, not null]
name varchar(255)
username varchar(255) [unique]
email varchar(255) [not null, unique]
emailVerified timestamp(3) [default: `(now())`]
image varchar(255)
indexes {
name [name: 'name_idx']
}
}
table users_to_secrets {
userId varchar(255) [not null]
secretId int [not null]
indexes {
(userId, secretId) [pk]
}
}
table verificationToken {
identifier varchar(255) [not null]
token varchar(255) [not null]
expires timestamp [not null]
indexes {
(identifier, token) [pk]
}
}
ref: attachments.secret_id > secrets.id
ref: friendship.user_id - user.id
ref: friendship.friend_id > user.id
ref: secrets.created_by_user_id > user.id
ref: users_to_secrets.userId > user.id
ref: users_to_secrets.secretId > secrets.id