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