-
Notifications
You must be signed in to change notification settings - Fork 1
Database Schema
Hanqing Chen edited this page Aug 8, 2018
·
6 revisions
App Academy Full Stack Project
Flickr Clone Database Schema
| Column Name | Data Type | Details |
|---|---|---|
| id | Integer | not null, primary key |
| username | String | not null, indexed, unique |
| String | not null, indexed, unique | |
| password_digest | String | not null |
| session_token | String | not null, indexed, unique |
| created_at | datetime | not null |
| profile_pic_url | String | not null |
| fname | String | not null |
| lname | String | not null |
- has many
photos - has many
albums - has many
comments -
username,email,session_tokenvalidation:indexed: true,uniqueness: true
| Column Name | Data Type | Details |
|---|---|---|
| id | Integer | not null, primary key |
| image_url | String | not null, unique |
| owner_id | Integer | not null, foreign key, indexed |
| name | String | not null, unique |
| description | String | not null |
| uploaded_at | datetime | not null |
-
owner_idreferences users - has many albums through
PhotoAlbumstable -
image_url,namevalidation:uniqueness: true
| Column Name | Data Type | Details |
|---|---|---|
| id | Integer | not null, primary key |
| creator_id | Integer | not null, foreign key, indexed |
| name | String | not null |
| description | String | not null |
| created_at | datetime | not null |
-
creator_idreferences users - has many
photosthroughPhotoAlbumstable
| Column Name | Data Type | Details |
|---|---|---|
| id | Integer | not null, primary key |
| album_id | Integer | not null, foreign key, indexed |
| photo_id | Integer | not null, foreign key, indexed |
-
album_idreferences albums -
photo_idreferences photos
| Column Name | Data Type | Details |
|---|---|---|
| id | Integer | not null, primary key |
| commentor_id | Integer | not null, foreign key |
| photo_id | Integer | not null |
| name | String | not null, indexed |
| body | Text | not null |
| created_at | datetime | not null |
-
commentor_idreferences users -
photo_idreferences photos
| Column Name | Data Type | Details |
|---|---|---|
| id | Integer | not null, primary key |
| user_id | Integer | not null, indexed |
| photo_id | Integer | not null, foreign key, indexed |
| tags | string | not null |
| created_at | datetime | not null |
-
user_idreferences users -
photo_idreferences photos