JoeyMBrown / bellator

An application used to log workouts.
0 stars 0 forks source link

Generate Migrations #1

Closed JoeyMBrown closed 1 month ago

JoeyMBrown commented 1 month ago

following_user_id integer
followed_user_id integer
created_at timestamp
}

Table users {
id integer [primary key]
username varchar
role varchar
created_at timestamp
}

Table posts {
id integer [primary key]
title varchar
body text [note: 'Content of the post']
user_id integer
status varchar
created_at timestamp
}

Table workouts {
id integer [primary key]
workout_type_id integer
user_id integer
name varchar
description varchar
created_at timestamp
}

Table exercises {
workout_id integer
exercise_type_id integer
user_id integer
id integer [primary key]
name varchar
description varchar
created_at timestamp
}

Table exercise_types {
id integer [primary key]
name varchar
description varchar
created_by_user_id integer
created_at timestamp
}

Table workout_types {
id integer [primary key]
name varchar
description varchar
created_by_user_id integer
created_at timestamp
}

Table exercise_sets {
  id integer [primary key]
  exercise_id integer
  user_id integer // This is redundant but will make it 1 join for all a user's sets
  repitions integer
  weight integer // Store all weight as lbs - value objects or model attributes for conversions?
}

Ref: posts.user_id > users.id // many-to-one

Ref: users.id < follows.following_user_id

Ref: users.id < follows.followed_user_id

Ref: users.id < workouts.user_id

Ref: users.id < exercises.user_id

Ref: workouts.id < exercises.workout_id

Ref: exercise_types.id < exercises.exercise_type_id

Ref: workout_types.id < workouts.workout_type_id 

Ref: "exercise_sets"."exercise_id" < "exercises"."id"

Ref: "exercise_sets"."user_id" < "users"."id"