-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.dbml
69 lines (53 loc) · 954 Bytes
/
main.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
Table user {
id int [pk]
email string [unique]
password string
}
Table sender {
id int [pk]
// created by
user_id int [ref: > user.id]
device_id string [unique]
}
Table user_sender {
user_id int [ref: > user.id]
sender_id int [ref: > sender.id]
indexes {
(user_id, sender_id) [pk]
}
}
enum ussr_requestor {
user
sender
}
enum ussr_status {
requested
accepted
rejected
}
Table user_sender_req {
id int [pk]
user_id int [ref: > user.id]
sender_id int [ref: > sender.id]
requestor ussr_requestor
status ussr_status
}
Table user_api_key {
api_key string [pk]
user int [ref: > user.id]
api_secret string
// expires after epoch 0 is deactivated
expiresAfter timestamp
}
Table batch {
id int [pk]
queued_at timestamp
}
Table message {
to string
content string
batch_id int [ref: > batch.id]
sent_at timestamp
user_id int [ref: > user.id]
sent_from int [ref: > sender.id]
}