feat: phase 3 — history endpoints (start, entries, complete)
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- Added the required column `programId` to the `histories` table without a default value. This is not possible if the table is not empty.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE "histories" ADD COLUMN "completedAt" TIMESTAMP(3),
|
||||
ADD COLUMN "programId" TEXT NOT NULL;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "histories" ADD CONSTRAINT "histories_programId_fkey" FOREIGN KEY ("programId") REFERENCES "programs"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
@@ -88,6 +88,7 @@ model Program {
|
||||
|
||||
exercises ProgramExercise[]
|
||||
groups GroupProgram[]
|
||||
histories History[]
|
||||
|
||||
@@map("programs")
|
||||
}
|
||||
@@ -111,12 +112,15 @@ model ProgramExercise {
|
||||
// ─── History ─────────────────────────────────────────────────────────────────
|
||||
|
||||
model History {
|
||||
id String @id @default(uuid())
|
||||
date DateTime @default(now())
|
||||
notes String?
|
||||
id String @id @default(uuid())
|
||||
date DateTime @default(now())
|
||||
completedAt DateTime?
|
||||
notes String?
|
||||
|
||||
userId String
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
userId String
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
programId String
|
||||
program Program @relation(fields: [programId], references: [id], onDelete: Cascade)
|
||||
|
||||
entries HistoryEntry[]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user