Skip to content

Commit

Permalink
chore: Add MovementType and TargetMuscle enums to schema and migration
Browse files Browse the repository at this point in the history
  • Loading branch information
thedemonsid committed Jul 25, 2024
1 parent c369aa9 commit 0729ef0
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 3 deletions.
20 changes: 20 additions & 0 deletions prisma/migrations/20240725044812_movement_type/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
Warnings:
- You are about to drop the column `how_to_make` on the `meals` table. All the data in the column will be lost.
- Made the column `imageUrl` on table `meals` required. This step will fail if there are existing NULL values in that column.
*/
-- CreateEnum
CREATE TYPE "MovementType" AS ENUM ('PUSH', 'PULL', 'LEGS', 'CORE', 'FULL_BODY');

-- CreateEnum
CREATE TYPE "TargetMuscle" AS ENUM ('CHEST', 'BACK', 'SHOULDERS', 'BICEPS', 'TRICEPS', 'FOREARMS', 'ABS', 'QUADS', 'HAMSTRINGS', 'CALVES', 'GLUTES', 'ADDUCTORS', 'ABDUCTORS', 'TRAPS', 'LATS', 'LOWER_BACK');

-- AlterTable
ALTER TABLE "meals" DROP COLUMN "how_to_make",
ALTER COLUMN "imageUrl" SET NOT NULL;

-- AlterTable
ALTER TABLE "workouts" ADD COLUMN "movementType" "MovementType" NOT NULL DEFAULT 'FULL_BODY',
ADD COLUMN "targetMuscle" "TargetMuscle"[];
34 changes: 31 additions & 3 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,13 @@ model MealInstance {
model Meal {
id String @id @default(cuid())
name String @unique
howToMake String @map(name: "how_to_make")
recipe String?
calories Float @default(0)
protein Float @default(0)
carbs Float @default(0)
fats Float @default(0)
fiber Float @default(0)
recipe String?
imageUrl String?
imageUrl String
videoUrl String?
createdAt DateTime @default(now()) @map(name: "created_at")
updatedAt DateTime @updatedAt @map(name: "updated_at")
Expand Down Expand Up @@ -123,6 +122,8 @@ model Workout {
name String @unique
howToDo String @map(name: "how_to_do")
duration Int
movementType MovementType @default(FULL_BODY)
targetMuscle TargetMuscle[]
difficulty Difficulty @default(BEGINNER)
imageUrl String
videoUrl String
Expand All @@ -138,3 +139,30 @@ enum Difficulty {
INTERMEDIATE
ADVANCED
}

enum MovementType {
PUSH
PULL
LEGS
CORE
FULL_BODY
}

enum TargetMuscle {
CHEST
BACK
SHOULDERS
BICEPS
TRICEPS
FOREARMS
ABS
QUADS
HAMSTRINGS
CALVES
GLUTES
ADDUCTORS
ABDUCTORS
TRAPS
LATS
LOWER_BACK
}
Empty file added src/lib/data/workout.js
Empty file.

0 comments on commit 0729ef0

Please sign in to comment.