schema - achynaliev/AppStarter GitHub Wiki
users
col_name | data_type | details |
---|---|---|
id | integer | not null, primary-key |
username | string | not null ,unique, indexed |
string | not null, unique, indexed | |
password_digest | string | not null |
image_url | string | |
session_token | string | not null, unique |
created_at | datetime | not null |
updated_at | datetime | not null |
- index on username, unique: true
- index on email, unique: true
projects
col_name | data_type | details |
---|---|---|
id | integer | not null, primary_key |
title | string | not null |
short_description | string | not null |
full_description | text | not null |
funding_goal | integer | not null |
funding_end_date | datetime | not null |
image_url | string | |
video_url | string | |
user_id | integer | not null, foreign_key, indexed |
created_at | datetime | not null |
updated_at | datetime | not null |
- user_id references users
- index on user_id
backings
col_name | data_type | details |
---|---|---|
id | integer | not null, primary_key |
user_id | integer | not null, foreign_key, indexed |
reward_id | integer | not null, foreign_key, indexed |
project_id | integer | not null, foreign_key, indexed |
- project_id references projects
- user_id references users
- reward_id references rewards
rewards
col_name | data_type | details |
---|---|---|
id | integer | not null, primary_key |
pledge_amount | integer | not null |
description | string | not null |
title | string | not null |
categories
col_name | data_type | details |
---|---|---|
id | integer | not null, primary_key |
name | string | not null, unique |
project_categories
col_name | data_type | details |
---|---|---|
id | integer | not null, primary_key |
project_id | integer | not null, foreign_key, indexed |
category_id | integer | not null, foreign_key, indexed |
- project_id references projects
- category_id references categories
- index on the combination of project_id and category_id
User associations
has_many projects
has_many backings
has_many rewards through backings
has_many recommendation
Project associations
belongs_to user
has_many backings
has_many rewards
has_many backers through backings
has_many categories through project_categories
Backings associations
belongs_to user
belongs_to rewards
has_one project through rewards
Categories associations
has_many projects through project_categories
project_categories
belongs_to project
belongs_to category
Rewards associations
belongs_to project
bonus
readings
col_name | data_type | details |
---|---|---|
id | integer | not null, primary_key |
image_url | string | not null |
link_url | string | not null |
category | string | not null |
recommendations
col_name | data_type | details |
---|---|---|
id | integer | not null, primary_key |
user_id | integer | not null, foreign_key |
category_id | integer | not null, foreign_key |
- user_id references users
- category_id references categories