DB schema - pauchye/ASTRA GitHub Wiki

users

column name data type details
id integer not null, primary key
username string not null, indexed, unique
first name string not null
last name string not null
gender string
email string not null, indexed, unique
location string
password_digest string not null, indexed, unique
session_token string not null, indexed, unique
created_at datetime not null
updated_at datetime not null
  • index on username, unique: true
  • index on email, unique: true
  • index on session_token, unique: true

routes

column name data type details
id integer not null, primary key
user id integer not null, foreign key
route name string not null
description text
activity string included: run, ride
road type string included: depends on activity
distance string not null
estimated duration integer not null
elevation integer not null
route_data string not null
created_at datetime not null
updated_at datetime not null
  • index on user id

workouts

column name data type details
id integer not null, primary key
user id integer not null, foreign key
route id integer not null, foreign key
distance integer not null
duration integer not null
elevation integer
sport string included: run, bike
date string not null
time string not null
title string not null
type string included: based on sport
gear integer not null
tags integer not null
description text
perceived exertion string included:
privacy control string included:
created_at datetime not null
updated_at datetime not null
  • index on user id, route id
  • index on gear