Database Schema - nhucleus/stumblr-app GitHub Wiki
Schema for PostgresQL using Sequelize ORM.
Users
| Column Name |
Data Type |
Details |
| id |
integer |
not null, primary key |
| firstName |
string |
not null |
| lastName |
string |
not null |
| username |
string |
not null, indexed, foreign key |
| email |
string |
not null, indexed, foreign key |
| avatar |
string |
no constraints |
| hashedPassword |
string |
not null |
| createdAt |
datetime |
not null |
| updatedAt |
datetime |
not null |
- unique
username
- unique
email
avatar will be URL to picture using AWS
Posts
| Column Name |
Data Type |
Details |
| id |
integer |
not null, primary key |
| userId |
integer |
not null, foreign key |
| title |
string |
no constraints |
| body |
text |
no constraints |
| urlContent |
string |
no constraints |
| type |
ENUM |
values: 'text', 'image', 'audio' |
| tags |
string |
no constraints |
Likes
| Column Name |
Data Type |
Details |
| id |
integer |
not null, primary key |
| userId |
integer |
not null, foreign key |
| postId |
integer |
not null, foreign key |
- Unique index on
userId and postId
Comments
| Column Name |
Data Type |
Details |
| id |
integer |
not null, primary key |
| userId |
integer |
not null, foreign key |
| postId |
integer |
not null, foreign key |
| text |
text |
not null |