pg
library with NPM.index.js
. Remember to update pgConnectionConfigs
to reference the new DB name.exercises
)workouts
)exercise_workouts
)workouts
table AND adds the corresponding rows in the exercise_workouts
table to associate the new workout with exercises.<DATE>
) and assume that it is an ID of an exercise. For each of these IDs it will create a row in the exercise_workouts
table.process.argv
, something like the following. In the following example, workoutExercises
will be an array of all exercises input on the command line. We can then iterate over workoutExercises
to insert the relevant records to our database.exercise_id
to get all workouts with that exercise. Make an INNER JOIN
query to list workout names with this exercise. Join on the workouts
and exercise_workouts
tables.exercises
table to get the relevant exercise ID. Then follow the same logic as before to get workouts.muscles
that gives body part categories to each exercise, like in the table here. An exercise will be associated with 1 or more muscles. Seed the muscles
table with some muscles.