Skip to content

UML to Relations

Nantawan Paramapooti edited this page Dec 23, 2024 · 21 revisions

UML class Relationships to Relation tables explanation

Updating
Translating directly from UML we've got:

Relation Attribute
Post post_id
post_content
timestamp
filter_content
User user_id
ChatRoom chatroom_id
ChatRequest chat request_id
action
status
ChatRole chatrole_id
ChatRank chatrank_id
allowed_actions
Message message_id
message_content
timestamp
Comment comment_id
comment_content
timestamp
Tag tag_id
tag_content
Like like_id
like_type
Share share_id
share_type
Report report_id
report_content
is_justified
ReportType report type_id
reporttype_name
reporttype_content
Notification notification_id
is_read
timestamp

Image from UML can be merged into PostImage and will be explained in the following translation

1. Post have likes

image

2. User posts content

image

3. Posts have tags

image

4. Post have comments

image

5. Post have shares

image

6. Post may or may not have many images

image

7. Post creation sends notifications to followers with notify on

image

8. Report post

image

9. Like sends

notifications to post owner image

10. Like by a user

image

11. Share sends

notifications to image

12. Share by a user

image

13. User have

interests image

14. User have

disinterests image

15. comment creation sends

notifications to post owner image

16. Report

comment image

17. Comment by a user

image

18. Report user

image

19. User

submits Report image

20. Notification is sent to a User

image

21. Users can

block eachother image

22. Users can follow eachother

image

23. User is notified when they get a follow

image

24. Report have types based on community guidelines

image

25. Users in a chat room

image

26. Chat role references a Rank

image

27. Report Chat Room

image

28. User get a notification when their Chat Role is changed

image

29. Chat request ( invite / kick )

image

30. Sender and Receiver Users get notification to chat request creation/changes

image

31. User receive Chat Request

image

32. User send Chat Request

image

33. Report Message

image

34. User send message

image

35. Users in the chatroom receives a notification from a message in chatrooms they are in

image

36. Chat room has messages

image

Translated Relations Result

Relation Attribute Foreign keys
Post post_id
user_id
post_content
timestamp
filter_content
user_id: User(user_id)
Follower user_id
follower_id
notify
user_id: User(user_id)
follower_id: User(user_id)
Blocker blocker_id
blocked_id
blocker_id: User(user_id)
blocked_id: User(user_id)
User user_id
username
email
password
user_name
birthday
bio
profile
header
color
language
filter_content
UserChat user_id
chat_id
user_id: User(user_id)
chat_id: ChatRoom(chat_id)
UserInterest user_id
tag_id
user_id: User(user_id)
tag_id : Tag(tag_id)
UserDisinterest user_id
tag_id
user_id: User(user_id)
tag_id : Tag(tag_id)
ChatRoom chat_id
chat_name
profile
ChatRequest chatrequest_id
chat_id
sender
receiver
action
status
chat_id : ChatRoom(chat_id)
sender : User(user_id)
receiver : User(user_id)
ChatRole chatrole_id
user_id
chatroom_id
chatrank_id
user_id : User(user_id)
chatroom_id : ChatRoom(chatroom_id)
chatrank_id : ChatRank(chatrank_id)
ChatRank chatrank_id
allowed actions
Message message_id
user_id
chat_id
message_content
timestamp
user_id: User(user_id)
chat_id: ChatRoom(chat_id)
Comment comment_id
user_id
post_id
comment_content
timestamp
user_id: User(user_id)
post_id: Post(post_id)
Tag tag_id
tag_content
PostTag tag_id
post_id
tag_id: Tag(tag_id)
post_id: Post(post_id)
Like like_id
user_id
post_id
like_type
user_id: User(user_id)
post_id: Post(post_id)
Share share_id
user_id
post_id
share_type
post_id: Post(post_id)
user_id: User(user_id)
ReportType reporttype_id
reporttype_name
reporttype_content
Report report_id
report_of
reporter_id
reporttype_id
report_content
is_justified
report_of : Class object User, Post, Comment, Chatroom, Message
reporter_id : User(user_id)
reporttype_id : ReportType(reporttype_id)
PostImage postimage_id
post_id
image
post_id : Post(post_id)
Notification notification_id
notification_of
receiver_id
is_read
timestamp
notification_of : Class object Follow, Like, Share, Post, Comment, Message, ChatRole, ChatRequest(receiver/sender is different)
receiver_id : User(user_id)

Clone this wiki locally