Database Schema - Sheeptoaster/Capstone GitHub Wiki
Database Schema
Schema

Tables
|
Users |
|
| id |
INT |
PK |
| username |
STRING(25) |
NOT NULL |
| firstName |
string(55) |
NOT NULL |
| lastName |
string(55) |
NOT NULL |
| email |
string |
NOT NULL |
| balance |
numeric |
NOT NULL |
| hashedPassword |
string |
NOT NULL |
|
Stocks |
|
| id |
INT |
PK |
| name |
STRING(50) |
NOT NULL |
| ticker |
string |
NOT NULL |
| price |
numeric |
NOT NULL |
| weight |
numeric |
NOT NULL |
|
Portfolio |
|
| id |
INT |
PK |
| userId |
int |
NOT NULL FK Users.id |
| stockId |
int |
NOT NULL FK Stocks.id |
| count |
numeric |
NOT NULL |
| purchasePrice |
numeric |
NOT NULL |
|
Transactions |
|
| id |
INT |
PK |
| userId |
int |
NOT NULL FK Users.id |
| stockId |
int |
NOT NULL FK Stocks.id |
| bought |
boolean |
NOT NULL |
| amount |
numeric |
NOT NULL |
| price |
numeric |
NOT NULL |
| timestamp |
timestamp |
NOT NULL |
|
PriceHistory |
|
| id |
INT |
PK |
| stockId |
int |
NOT NULL FK Stocks.id |
| price |
numeric |
NOT NULL |
| time |
timestamp |
NOT NULL |
| interval |
varchar |
NOT NULL |
|
Watchlist |
|
| id |
INT |
PK |
| userId |
int |
NOT NULL FK Users.id |
| stockId |
int |
NOT NULL FK Stocks.id |
| priceAlert |
numeric |
NOT NULL |