Skip to content

Database Schema Draft

jmiggs edited this page Apr 27, 2020 · 15 revisions

RobinStax DB Schema

This is the working schema for the RobinStax app.

users

column name datatype details
id integer not null, primary key
username string not null, indexed, unique
email 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.

watchlists

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)

assets

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

watchListItems

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

Clone this wiki locally