Schema - aknishi/stringitapp GitHub Wiki

Users

Column Data-Type Details
id integer not null, primary_key, unique
name string not null, indexed
email string not null, unique, indexed
password_digest string not null
session_token string not null, unique, indexed
phone number string not null .
address string not null
comment string not null
admin boolean not null, indexed, default: false
date_created datetime not null
  • Users have many orders.
  • A user has and belongs to many rackets.
  • Users have many order lines through orders

Orders

Column Data-Type Details
id integer not null, primary_key, unique
order_number integer not null, index
customer_id string not null, index, foreign_key
status integer not null, default: "Pending"
comments integer
date_created datetime not null
  • Orders belong to a customer and have many order lines.
  • Orders have many rackets and cords(strings) through orderlines.

OrderLines

Column Data-Type Details
id integer not null, primary_key, unique
order_id integer not null, index, foreign_key
racket_id integer not null, foreign_key
main_cord_id integer not null, foreign_key
cross_cord_id integer not null, foreign_key
main_tension integer not null
cross_tension integer not null
created_at datetime not null
  • An orderline belongs to an order, to a racket and to cords(strings).

Rackets

Column Data-Type Details
id integer not null, primary_key, unique
brand string not null, index
model string not null, index
color string
image_url string
date_created datetime not null

index brand and model

  • Rackets have many order lines.
  • They also have and belong to many users.

Cords (strings)

Column Data-Type Details
id integer not null, primary_key, unique
brand string not null, index
model string not null, index
gauge string not null
length integer not null
composition string not null
color string
image_url string
date_created datetime not null

index brand and model

  • Cords (strings) have many order_lines_1 with foreign_key :main_cord_id
  • Cords (strings) have many order_lines_2 with foreign_key :cross_cord_id