Database Schema - makon57/MixTrail GitHub Wiki
Users
| column name |
data type |
details |
| id |
integer |
not null, PK |
| username |
string(50) |
not null, unique |
| email |
string(255) |
not null, unique |
| password |
|
not null |
| createdAt |
date |
not null |
| updatedAt |
date |
not null |
- hasMany Reviews
- hasMany TrailLists
- hasMany Trails through Reviews association
TrailLists
| column name |
datatype |
details |
| id |
integer |
not null, PK |
| name |
string(255) |
not null, unique |
| userId |
integer |
not null, FK(Users) |
| createdAt |
date |
not null |
| updatedAt |
date |
not null |
- belongsTo Users
- belongsToMany Trails through Joins association
Joins
| column name |
datatype |
details |
| id |
integer |
not null, PK |
| trailId |
integer |
not null, FK(Trails) |
| trailListId |
integer |
not null, FK(TrailList) |
| hasVisited |
boolean |
|
| wantToVisit |
boolean |
|
| createdAt |
date |
not null |
| updatedAt |
date |
not null |
- belongsTo TrailLists
- hasMany Trails
Trails
| column name |
datatype |
details |
| id |
integer |
not null, PK |
| name |
string(50) |
not null, unique |
| description |
text |
not null |
| state |
string(50) |
not null |
| createdAt |
date |
not null |
| updatedAt |
date |
not null |
- belongsToMany TrailLists through Joins
- hasMany Reviews
Reviews
| column name |
datatype |
details |
| id |
integer |
not null, PK |
| trailId |
integer |
not null, FK(Trails) |
| userId |
integer |
not null, FK(Users) |
| rating |
integer |
not null |
| text |
text |
not null |
| createdAt |
date |
not null |
| updatedAt |
date |
not null |
- belongsTo Users
- belongsTo Trails
