Skip to content

UML to Relations

Kantapon Hemmadhun edited this page Nov 13, 2024 · 21 revisions

UML class Relationships to Relation tables explanation

1. User posts content

Screenshot 2024-11-13 160018

This relation represents posts made by users in the system. Each user can create multiple posts, allowing for a one-to-many relationship between the User table and the Post table

2. Chatroom

Chatroom 2024-11-13 160124

This relation represents chat rooms that users can join. Each chat room is identified by a unique chat_id and has a chat_name for easy identification. Users can participate in multiple chat rooms, enabling group conversations or topic-specific discussions within the application.

3. User Block

User Block 2024-11-13 160153

This relation represents the blocking relationships between users, allowing for a many-to-many association where one user can block multiple users

4. User Follow

Userfollow 2024-11-13 160307

This relation represents the following relationships between users, allowing for a many-to-many association where one user can follow each other.

5. Message

Message 2024-11-13 160352

6.

7.

8.

9.

Translated Relations Result

Relation Attribute Foreign keys
Post post_id
user_id
p_content
timestamp
user_id: User(user_id)
Follower user_id
follower_id
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
name
bio
UserChat user_id
chat_id
user_id: User(user_id)
chat_id: ChatRoom(chat_id)
ChatRoom chat_id
chat_name
Message message_id
user_id
chat_id
ms_content
timestamp
user_id: User(user_id)
chat_id: ChatRoom(chat_id)
Comment comment_id
user_id
post_id
c_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)
Likes like_id
user_id
post_id
user_id: User(user_id)
post_id: Post(post_id)
Shares share_id
user_id
post_id
share_type
post_id: Post(post_id)
user_id: User(user_id)

Clone this wiki locally