Replies: 16 comments 7 replies
-
|
| Column | Data Type | Key | Description |
|---|---|---|---|
| id | INT | PRIMARY KEY | A unique identifier for each user |
| username | VARCHAR(255) | NOT NULL, UNIQUE | The username of the user |
| password | VARCHAR(255) | NOT NULL | The password of the user |
| VARCHAR(255) | NOT NULL, UNIQUE | The email of the user | |
| email_visibility | BOOLEAN | Whether the user's email to the public | |
| verified | BOOLEAN | Whether the user's email is verified | |
| display_name | VARCHAR(255) | NOT NULL | The display name of the user |
| tag_name | VARCHAR(255) | NOT NULL, UNIQUE | The tag name of the user |
| profile_description | TEXT | A brief description of the user's profile | |
| profile_picture | VARCHAR(255) | The URL of the user's profile picture | |
| avatar | VARCHAR(255) | The URL of the user's avatar | |
| is_admin | BOOLEAN | NOT NULL | A flag to indicate if the user is an admin or not |
| last_login_time | DATETIME | The date and time of the user's last login |
Beta Was this translation helpful? Give feedback.
-
|
| Column | Data Type | Key | Description |
|---|---|---|---|
| user_id | INT | NOT NULL | The user_id of the user who posted the tweet |
| is_public | BOOLEAN | NOT NULL | Indicates whether the tweet is public or private |
| tweet_text_id | INT | NOT NULL, UNIQUE | The id of the latest tweet text that is associated with this tweet |
| scheduled_at | DATETIME | The date and time the tweet is scheduled to be posted | |
| published_at | DATETIME | The date and time the tweet was published |
Beta Was this translation helpful? Give feedback.
-
|
| Column | Data Type | Key | Description |
|---|---|---|---|
| tweet_id | INT | NOT NULL | The tweet_id of the tweet that the text belongs to |
| tweet_text | VARCHAR(255) | NOT NULL | The text of the tweet |
Beta Was this translation helpful? Give feedback.
-
|
| Column | Data Type | Key | Description |
|---|---|---|---|
| hashtag_text | VARCHAR(255) | NOT NULL, UNIQUE | The text of the hashtag |
Beta Was this translation helpful? Give feedback.
-
|
| Column | Data Type | Key | Description |
|---|---|---|---|
| tweet_id | INT | NOT NULL | The tweet_id of the tweet associated with the hashtag |
| hashtag_id | INT | NOT NULL | The hashtag_id of the hashtag associated with the tweet |
Beta Was this translation helpful? Give feedback.
-
|
| Column | Data Type | Key | Description |
|---|---|---|---|
| user_id | INT | NOT NULL | The user_id of the person being followed |
| follower_id | INT | NOT NULL | The user_id of the person doing the following |
Beta Was this translation helpful? Give feedback.
-
|
| Column | Data Type | Key | Description |
|---|---|---|---|
| user_id | INT | NOT NULL | The user_id of the person who liked the tweet |
| tweet_id | INT | NOT NULL | The tweet_id of the tweet that was liked |
Beta Was this translation helpful? Give feedback.
-
|
| Column | Data Type | Key | Description |
|---|---|---|---|
| retweet | INT | NOT NULL | The tweet that is the retweet |
| original_tweet | INT | NOT NULL | The tweet_id of the tweet that was retweeted |
| on_profile | Boolean | NOT NULL | True for retweets, false for reply |
Beta Was this translation helpful? Give feedback.
-
|
| Column | Data Type | Key | Description |
|---|---|---|---|
| tweet_id | INT | NOT NULL UNIQUE | The tweet_id of the tweet that this poll is associated with |
| end_time | DATETIME | The date and time the poll will end (optional) |
Beta Was this translation helpful? Give feedback.
-
|
| Column | Data Type | Key | Description |
|---|---|---|---|
| poll_id | INT | NOT NULL | The poll_id of the poll that this option is associated with |
| option_text | TEXT | NOT NULL | The text of the option |
Beta Was this translation helpful? Give feedback.
-
|
| Column | Data Type | Key | Description |
|---|---|---|---|
| tweet_id | INT | NOT NULL | The tweet_id of the tweet that this attachment is associated with |
| attachment_type | ENUM('image', 'video') | NOT NULL | The type of attachment (image or video) |
| attachment_url | TEXT | NOT NULL | The URL of the attachment |
Beta Was this translation helpful? Give feedback.
-
|
The chat functionality of the database is comprised of the following tables:
|
Beta Was this translation helpful? Give feedback.
-
|
| Column Name | Data Type | Constraint | Description |
|---|---|---|---|
| sender_id | INT | FOREIGN KEY | User who sent the message |
| chatroom_id | INT | FOREIGN KEY | Chatroom the message is sent to |
| content_id | INT | FOREIGN KEY | Reference to the message content table |
Beta Was this translation helpful? Give feedback.
-
|
| Column Name | Data Type | Constraint | Description |
|---|---|---|---|
| content | TEXT | NOT NULL | Content of the message, could be a URL pointing to a file or just plain text |
| content_type | VARCHAR(255) | NOT NULL | Denotes how the content should be treated (e.g. text, image, video, voice) |
Beta Was this translation helpful? Give feedback.
-
|
| Column Name | Data Type | Constraint | Description |
|---|---|---|---|
| name | VARCHAR(255) | NOT NULL | Name of the chatroom |
Beta Was this translation helpful? Give feedback.
-
|
| Column Name | Data Type | Constraint | Description |
|---|---|---|---|
| user_id | INT | FOREIGN KEY | User who is a member of the group chat |
| chatroom_id | INT | FOREIGN KEY | chatroom the user is a member of |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
The designed schema for the Twitter Clone is composed of several tables:
userstable stores information about each user including their username, password, email, display name, tag name, last login time, and a flag to indicate whether they are an admin user.tweetstable stores information about each tweet including the tweet ID, user ID, text, created time, published time, scheduled time, and a flag to indicate whether the tweet is public or private.tweet_texttable stores the text of each tweet and keeps track of its history if it was edited. It has a one-to-many relationship with the tweets table.tweet_hashtagstable stores the hashtags associated with each tweet and has a many-to-many relationship with the hashtags table.tweet_attachmentstable stores information about each attachment for a tweet, including the attachment ID, tweet ID, type, and URL.hashtagstable stores all hashtags used in the Twitter Clone.tweet_pollstable stores information about each poll associated with a tweet, including the poll ID, tweet ID, end time, and a one-to-many relationship with the poll_options table.poll_optionstable stores the options for each poll and the number of votes for each option.retweetstable stores information about each retweet, including the retweet ID, user ID, tweet ID, and the time it was retweeted. It has a one-to-one relationship with the tweets table.followerstable stores the relationships between users and has two fields, follower_id and followed_id, which create a many-to-many relationship between users.likestable stores the relationships between users and tweets, indicating which user liked which tweet. It has two fields, user_id and tweet_id, creating a many-to-many relationship between users and tweets.All tables will have
id,created,updatedby defaultBeta Was this translation helpful? Give feedback.
All reactions