-
Notifications
You must be signed in to change notification settings - Fork 0
/
entity-relationship-diagram.dbml
113 lines (100 loc) · 2.32 KB
/
entity-relationship-diagram.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
108
109
110
111
112
113
Table User {
id UUID [pk]
username String
profilePicture String // Adjust type as needed (e.g., URL or BLOB)
firstName String
lastName String
bio String
}
Table FriendTag {
id UUID [pk]
displayName String
color String
}
// Junction table for User-FriendTag relationship (One-to-Many)
Table UserFriendTag {
userId UUID [ref: > User.id]
friendTagId UUID [ref: > FriendTag.id]
indexes {
(userId, friendTagId) [pk]
}
}
Table Event {
id UUID [pk]
title String
startTime Timestamp
endTime Timestamp
locationId UUID [ref: > Location.id]
note String
creatorId UUID [unique, ref: > User.id]
}
// Junction table for Event Tags (Many-to-Many)
Table EventTag {
eventId UUID [ref: > Event.id]
tagId UUID [ref: > FriendTag.id]
indexes {
(eventId, tagId) [pk]
}
}
// Junction table for Event Participants (One-to-Many)
Table EventParticipants {
eventId UUID [ref: > Event.id]
userId UUID [ref: > User.id]
indexes {
(eventId, userId) [pk]
}
}
// Junction table for Event Invited (One-to-Many)
Table EventInvited {
eventId UUID [ref: > Event.id]
userId UUID [ref: > User.id]
indexes {
(eventId, userId) [pk]
}
}
Table ChatMessage {
id UUID [pk]
timestamp Timestamp
userId UUID [ref: > User.id, unique]
content String
eventId UUID [ref: > Event.id] // Association with Event
}
// Junction table for ChatMessage Likes (Many-to-Many)
Table ChatMessageLikes {
chatMessageId UUID [ref: > ChatMessage.id]
userId UUID [ref: > User.id]
indexes {
(chatMessageId, userId) [pk]
}
}
// Table for Friend relationships (Many-to-Many)
Table UserFriends {
userId1 UUID [ref: > User.id]
userId2 UUID [ref: > User.id]
indexes {
(userId1, userId2) [pk]
}
}
Table UserFriendTagMapping {
id UUID [pk]
userId1 UUID [ref: > User.id]
userId2 UUID [ref: > User.id]
friendTagId UUID [ref: > FriendTag.id]
indexes {
(userId1, userId2, friendTagId) [pk]
}
}
// Table for Friend Requests (Many-to-Many)
Table FriendRequests {
senderId UUID [ref: > User.id]
receiverId UUID [ref: > User.id]
indexes {
(senderId, receiverId) [pk]
}
}
Table Location {
id UUID [pk]
name String
latitude Double
longitude Double
}