Schema - slavnikov/BootUp GitHub Wiki
Database Schema
users
| Column Name |
Data Type |
Details |
| id |
int |
pk |
| name |
str |
nn |
| email |
str |
nn, u |
| session_token |
str |
nn, u |
| password_digest |
str |
nn |
| picture_url |
str |
|
| biography |
txt |
|
| location |
str |
|
| time_zone |
int |
|
- users' email addresses will be used as usernames and will be the primary key of looking up users
has_many comments, backed_projects, rewards
projects
| Column Name |
Data Type |
Details |
| id |
int |
pk |
| admin_id |
int |
fk, nn |
| pledge_goal |
int |
nn |
| title |
str |
nn, u |
| subtitle |
str |
nn |
| category |
str |
nn |
| subcategory |
str |
|
| subtitle |
txt |
nn |
| country |
str |
nn |
| story |
txt |
nn |
| end_date |
date |
nn |
admin_id references user table
belongs_to a user
has_many rewards, backers, comments
rewards
| Column Name |
Data Type |
Details |
| id |
int |
pk |
| project_id |
int |
fk, nn |
| title |
str |
nn |
| pledge_amt |
int |
nn |
| description |
txt |
nn |
porject_id links the rewards to their respective projects
- index on
[project_id, title], unique: true
- index on
[project_id, pldege_amt], unique: true
has_many recipients
backings
| Column Name |
Data Type |
Details |
| id |
int |
pk |
| backer_id |
int |
fk, nn |
| project_id |
int |
fk, nn |
| reward_id |
int |
fk, nn |
- links
users to their backed_projects and to their rewards
- index on
[backer_id, project_id, reward_id], unique: true
- links
projects to their backers
- links
rewards to their recipients