This repository contains the normalized database schema for a Twitter-like application. The schema is designed to meet the following requirements:
- Users can register with their name, email, and phone number.
- Users can tweet any textual content.
- Users can like another user's tweet.
- Users can retweet another user's tweet.
- Users can comment on another user's tweet (comments are treated as tweets).
- Users can follow other users.
- Attributes:
id(Primary Key)emailpasswordnamephone_numberfollowers_countfollowing_counttweet_count
- Attributes:
tweetId(Primary Key)userId(Foreign Key referencing User)tweetContentcreated_atcomment
- Attributes:
likeId(Primary Key)userId(Foreign Key referencing User)tweetId(Foreign Key referencing Tweet)created_at
- Attributes:
retweetId(Primary Key)userId(Foreign Key referencing User)tweetId(Foreign Key referencing Tweet)created_at
- Attributes:
id(Primary Key)followerId(Foreign Key referencing User)followingId(Foreign Key referencing User)created_at
- One-to-Many relationship between User and Tweet (one user can have multiple tweets).
- Many-to-Many relationship between User and User (through Follower table for followers/following).
- One-to-Many relationship between User and Like (one user can like multiple tweets).
- One-to-Many relationship between User and Retweet (one user can retweet multiple tweets).
- One-to-Many relationship between User and Comment (one user can comment on multiple tweets).
The database schema diagram was created using dbdesigner.net(Links to an external site).
