Schema - mataghva/Footprint GitHub Wiki

Database Schema

users

column name data type details
id integer not null, primary key
first_name string not null
last_name string not null
email string not null, indexed, unique
profile_pic_id integer
password_digest string not null
session_token string not null, indexed, unique
created_at datetime not null
updated_at datetime not null
  • index on email, unique: ture
  • index on session_token, unique: true

trails

column name data type details
id integer not null, primary key
name string not null, indexed, unique
description text not null
short_descr text not null
length float not null
longitude float not null
latitude float not null
elevation_gain integer not null
difficulty string not null
usage string not null
route_type string not null
features string not null
rating float not null
park_id integer not null, indexed, foreign key
created_at datetime not null
updated_at datetime not null
  • park_id refrences park
  • indexed on name, unique: true
  • indexed on park_id, unique: true

parks

column name data type details
id integer not null, primary key
name string not null, indexed, unique
description text
acreage integeer
rating float not null
created_at datetime not null
updated_at datetime not null
  • indexed on name, unique: true

reviews

column name data type details
id integer not null, primary key
title string not null, indexed, unique
body text not null
user_id integer not null, indexed, foreign key
trail_id integer not null, indexed, foreign key
rating float not null
created_at datetime not null
updated_at datetime not null
  • user_id refrences author
  • trail_id refrences trail
  • index on title, unique: true
  • index on user_id, unique: true
  • index on trail_id, unique: true