Skip to content

Instantly share code, notes, and snippets.

@jha-adrs
Created February 2, 2024 13:50
Show Gist options
  • Save jha-adrs/69858f44323d2bdfee97e50a77a7e15d to your computer and use it in GitHub Desktop.
Save jha-adrs/69858f44323d2bdfee97e50a77a7e15d to your computer and use it in GitHub Desktop.
AI Trainer Schema
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model User {
id Int @id @default(autoincrement())
name String
username String @unique
password String
email String @unique
age Int
height Float
weight Float
dob DateTime
bmi Float
gender String
goal Goal[]
progress Progress[]
workoutPlan WorkoutPlan[]
feedback Feedback[]
achievement Achievement[]
}
model Goal {
id Int @id @default(autoincrement())
userId Int
goalWeight Float
goal String
goalBmi Float
user User @relation(fields: [userId], references: [id])
}
model Exercise {
id Int @id @default(autoincrement())
name String
bodyJointCoordinates String
targetBodyPart String
difficulty String
reps Int
workouts Workout[]
equipmentId Int
equipment Equipment @relation(fields: [equipmentId], references: [id])
}
model Workout {
id Int @id @default(autoincrement())
exerciseId Int
workoutDuration Int
difficultyLevel String
exercise Exercise @relation(fields: [exerciseId], references: [id])
workoutPlanId Int
workoutPlan WorkoutPlan @relation(fields: [workoutPlanId], references: [id])
}
model Admin {
id Int @id @default(autoincrement())
login String @unique
password String
}
model Nutrition {
id Int @id @default(autoincrement())
calories Int
dietType String
food String
protein Float
fat Float
carbs Float
vitamins String
minerals String
meal Meal[]
}
model Progress {
id Int @id @default(autoincrement())
userId Int
avgSleep Float
workoutDuration Int
caloriesBurnt Int
weight Float
accuracyExercise Float
user User @relation(fields: [userId], references: [id])
}
model Meal {
id Int @id @default(autoincrement())
name String
calories Int
dietType String
ingredients String
nutritionId Int
nutrition Nutrition @relation(fields: [nutritionId], references: [id])
}
model WorkoutPlan {
id Int @id @default(autoincrement())
name String
userId Int
user User @relation(fields: [userId], references: [id])
workouts Workout[]
}
model Feedback {
id Int @id @default(autoincrement())
userId Int
content String
rating Int
user User @relation(fields: [userId], references: [id])
}
model Equipment {
id Int @id @default(autoincrement())
name String
description String
exercises Exercise[]
}
model Achievement {
id Int @id @default(autoincrement())
name String
description String
userId Int
user User @relation(fields: [userId], references: [id])
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment