second commit
This commit is contained in:
@@ -78,6 +78,7 @@ CREATE TABLE `MesoCycle` (
|
||||
`totalWeeks` INTEGER NOT NULL,
|
||||
`currentWeek` INTEGER NOT NULL,
|
||||
`isAsync` BOOLEAN NOT NULL,
|
||||
`userId` VARCHAR(191) NOT NULL,
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
@@ -110,6 +111,7 @@ CREATE TABLE `WorkoutSession` (
|
||||
`isDeload` BOOLEAN NOT NULL,
|
||||
`completedAt` DATETIME(3) NULL,
|
||||
`mesoCycleDayId` INTEGER NOT NULL,
|
||||
`userId` VARCHAR(191) NOT NULL,
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
@@ -142,6 +144,9 @@ ALTER TABLE `session` ADD CONSTRAINT `session_userId_fkey` FOREIGN KEY (`userId`
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `account` ADD CONSTRAINT `account_userId_fkey` FOREIGN KEY (`userId`) REFERENCES `user`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `MesoCycle` ADD CONSTRAINT `MesoCycle_userId_fkey` FOREIGN KEY (`userId`) REFERENCES `user`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `MesoCycleDay` ADD CONSTRAINT `MesoCycleDay_mesoCycleId_fkey` FOREIGN KEY (`mesoCycleId`) REFERENCES `MesoCycle`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
@@ -154,6 +159,9 @@ ALTER TABLE `MesoCycleExercise` ADD CONSTRAINT `MesoCycleExercise_exerciseId_fke
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `WorkoutSession` ADD CONSTRAINT `WorkoutSession_mesoCycleDayId_fkey` FOREIGN KEY (`mesoCycleDayId`) REFERENCES `MesoCycleDay`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `WorkoutSession` ADD CONSTRAINT `WorkoutSession_userId_fkey` FOREIGN KEY (`userId`) REFERENCES `user`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `ExerciseLog` ADD CONSTRAINT `ExerciseLog_workoutSessionId_fkey` FOREIGN KEY (`workoutSessionId`) REFERENCES `WorkoutSession`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
@@ -21,6 +21,8 @@ model User {
|
||||
updatedAt DateTime @updatedAt
|
||||
sessions Session[]
|
||||
accounts Account[]
|
||||
mesoCycle MesoCycle[]
|
||||
workoutSession WorkoutSession[]
|
||||
|
||||
@@unique([email])
|
||||
@@map("user")
|
||||
@@ -89,8 +91,8 @@ model MesoCycle {
|
||||
totalWeeks Int
|
||||
currentWeek Int
|
||||
isAsync Boolean
|
||||
//user User @relation(fields: [userId], references: [id])
|
||||
//userId Int // for
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
userId String
|
||||
mesoCycleDays MesoCycleDay[]
|
||||
}
|
||||
|
||||
@@ -125,14 +127,13 @@ model WorkoutSession {
|
||||
completedAt DateTime? // Null until finished
|
||||
mesoCycleDay MesoCycleDay @relation(fields: [mesoCycleDayId], references: [id])
|
||||
mesoCycleDayId Int
|
||||
//user User @relation(fields: [userId], references: [id])
|
||||
//userId Int
|
||||
|
||||
exerciseLogs ExerciseLog[]
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
userId String
|
||||
exerciseLogs ExerciseLog[]
|
||||
}
|
||||
|
||||
model ExerciseLog {
|
||||
id Int @id @default(autoincrement())
|
||||
id Int @id @default(autoincrement())
|
||||
sets Int
|
||||
reps Int
|
||||
weight Decimal
|
||||
|
||||
@@ -6,4 +6,7 @@ export const auth = betterAuth({
|
||||
database: prismaAdapter(prisma, {
|
||||
provider: "mysql", // or "mysql", "postgresql", ...etc
|
||||
}),
|
||||
emailAndPassword: {
|
||||
enabled: true,
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user