-
Notifications
You must be signed in to change notification settings - Fork 1
Database Schema
Lema El-Sherbiny edited this page Aug 15, 2021
·
18 revisions
| column name | data type | details |
|---|---|---|
| id | integer | not null, primary key |
| username | string | not null, unique |
| string | not null, unique | |
| bio | string | not null |
| profile_pic | string | not null |
| hashedPassword | string | not null |
| created_at | timestamp | not null |
| updated_at | timestamp | not null |
| Column name | data type | details |
|---|---|---|
| following_id | integer | not null, Foreign Key |
| follower_id | integer | not null, Foreign Key |
-
following_idreferencesUserstable
many to many relationship [user can follow many users and also have many folowers]
-
follower_idreferencesUserstable
many to many relationship [user can follow many users and also have many folowers]
| Column name | data type | details |
|---|---|---|
| user_id | integer | not null, Foreign Key |
| post_id | integer | not null, Foreign Key |
-
user_idreferencesUserstable
many to many relationship [user can make likes on many post]
-
post_idreferencesPoststable
many to many relationship [post can have many likes created by many users]
| column name | data type | details |
|---|---|---|
| id | integer | not null, primary key |
| caption | string | not null |
| user_id | integer | not null, Foreign Key |
| post_id | integer | not null, Foreign Key |
| timestamp | datetime | not null |
| created_at | timestamp | not null |
| updated_at | timestamp | not null |
-
user_idreferencesUserstable
one to many relationship [user can make many comments but a comment can only belong to one user]
-
post_idreferencesPoststable
one to many relationship [a post can have many comments but a comment can only belong to one post]
| column name | data type | details |
|---|---|---|
| id | integer | not null, primary key |
| caption | string | not null |
| user_id | string | not null, Foreign Key |
| pic_url | string | not null |
| timestamp | datetime | not null |
| created_at | timestamp | not null |
| updated_at | timestamp | not null |
-
user_idreferencesUserstable
one to many relationship [user can make many post but a post can only be owned by one user]
