Database Schema - miketu926/GetStarted GitHub Wiki
users
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
email |
string | not null, indexed, unique |
name |
string | not null |
profile_picture |
string | |
password_digest |
string | not null |
session_token |
string | not null, indexed, unique |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on
email, unique: true
- index on
session_token, unique: true
user_id
has manyprojects
user_id
has manytransactions
user_id
has manypayment_infos
projects
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
project |
string | not null, indexed, unique |
description |
string | not null |
category |
string | not null |
location |
string | not null |
project_picture |
string | |
goal_amt |
integer | not null |
funded_amt |
integer | not null |
duration_days |
integer | not null |
user_id |
integer | not null, indexed, foreign key |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on
project, unique: true
- index on
user_id
user_id
belongs tousers
project_id
has manytransactions
project_id
has manytiers
tiers
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
project_id |
integer | not null, |
amount |
integer | not null, |
description |
string | not null |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on
project_id
project_id
belongs toprojects
transactions
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
transaction_amt |
integer | not null |
user_id |
integer | not null, indexed, foreign key |
project_id |
integer | not null, indexed, foreign key |
payment_info_id |
integer | not null, indexed, foreign key |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on
user_id
- index on
project_id
- index on
payment_info_id
user_id
belongs tousers
project_id
belongs toprojects
payment_info_id
belongs topayment_info
payment_info
- BONUS
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
cc_num |
integer | not null, indexed, unique |
cardholder |
string | not null |
expiration |
integer | not null |
security_code |
integer | not null |
zip |
integer | not null |
user_id |
integer | not null, indexed, foreign key |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on
cc_num, unique: true
- index on
user_id
user_id
belongs tousers
payment_info_id
has manytransactions