-
Notifications
You must be signed in to change notification settings - Fork 0
Database Schema Draft
jmiggs edited this page Apr 27, 2020
·
15 revisions
This is the working schema for the RobinStax app.
| column name | datatype | details |
|---|---|---|
| id | integer | not null, primary key |
| username | string | not null, indexed, unique |
| string | not null, indexed, unique | |
| password_digest | string | not null |
| session_token | string | not null, indexed, unique |
| created_at | datetime | not null |
| updated_at | date | not null |
| assets | string | array: true |
- index on username, unique: true
- index on email, unique: true
- index on session_token, unique: true
- assets will be an array and will contain subarrays that reference owned stock and how many of that stock is owned.
| column name | datatype | details |
|---|---|---|
| id | integer | not null, primary key |
| user_id | integer | not null, foreign key |
| name | string | not null |
| created_at | datetime | not null |
| updated_at | date | not null |
- user_id references users (as the owner of the watch list)
| column name | datatype | details |
|---|---|---|
| id | integer | not null, primary key |
| ticker | string | not null, indexed, unique |
| created_at | datetime | not null |
| updated_at | date | not null |
| user_id | integer | not null, foreign key |
- user_id references users
- index on user_id
| column name | datatype | details |
|---|---|---|
| id | integer | not null, primary key |
| ticker | string | not null, indexed, unique |
| created_at | datetime | not null |
| updated_at | date | not null |
| list_id | integer | not null |
- index on ticker, unique: true
- index on list_id
- list_id references watchlists