Schema - mstephan520/coinplace GitHub Wiki
Database Schema
users
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
email |
string | not null, indexed, unique |
first_name |
string | not null |
last_name |
string | not null |
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
coins
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
symbol |
string | not null, indexed, unique |
name |
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
trades
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
quantity |
float | not null |
type |
string | 'buy' or 'sell' |
price |
float | not null |
user_id |
integer | not null, indexed |
coin_id |
integer | not null, indexed |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on
user_id - index on 'coin_id'
follow_list
| column name | data type | details |
|---|---|---|
id |
integer | not null |
| 'user_id | integer | not null, indexed |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on
user_id
follow_list_coins
| column name | data type | details |
|---|---|---|
id |
integer | not null |
| 'follow_list_id | integer | not null, indexed |
| 'coin_id' | integer | not null, indexed |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on
follow_list_id - index on
coin_id
portfolio
| column name | data type | details |
|---|---|---|
id |
integer | not null |
| `user_id | integer | not null, indexed |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on
user_id
portfolio_coins
| column name | data type | details |
|---|---|---|
id |
integer | not null |
| 'portfolio_id | integer | not null |
| 'coin_id' | integer | not null |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on
portfolio_id - index on
coin_id