database schema - edmundho/TRACER GitHub Wiki

users

column name data type details
username string not null, unique, indexed
id integer not null, primary key
password_digest string not null
session_token string not null, indexed, unique
first_name string not null
last_name string not null
birth_date date not null, default 01/01/2000
profile_pic string default avatar
  • has_many :routes, :comments, :photos

routes

column name data type details
id integer not null, primary key
user_id integer not null, foreign key, indexed
title string not null
sport integer not null, indexed, rails enum
distance float not null
elevation float not null
description text
polyline_string text not null
origin string not null
destination string not null
  • has_one user

activities

column name data type details
id integer not null, primary key
user_id integer not null, foreign key, indexed
title string not null
sport integer not null, indexed, rails enum, default: 0
date datetime not null
duration integer
distance float
elevation float
description text
route_id integer foreign key
  • has_one user
  • has_many :photos, :comments

photos

column name data type details
id integer not null, primary key
url string not null
author_id integer not null, foreign key, indexed
route_id integer not null, foreign key, indexed
  • belongs_to :author, :route

comments

column name data type details
id integer not null, primary key
body text not null
author_id integer not null, foreign key
route_id integer not null, foreign key
  • belongs_to :author, :route
⚠️ **GitHub.com Fallback** ⚠️