12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- /*
- Warnings:
- - You are about to drop the `WorkoutSession` table. If the table is not empty, all the data it contains will be lost.
- - You are about to drop the `WorkoutSessionExercise` table. If the table is not empty, all the data it contains will be lost.
- - You are about to drop the `WorkoutSet` table. If the table is not empty, all the data it contains will be lost.
- */
- -- DropForeignKey
- ALTER TABLE "WorkoutSession" DROP CONSTRAINT "WorkoutSession_userId_fkey";
- -- DropForeignKey
- ALTER TABLE "WorkoutSessionExercise" DROP CONSTRAINT "WorkoutSessionExercise_exerciseId_fkey";
- -- DropForeignKey
- ALTER TABLE "WorkoutSessionExercise" DROP CONSTRAINT "WorkoutSessionExercise_workoutSessionId_fkey";
- -- DropForeignKey
- ALTER TABLE "WorkoutSet" DROP CONSTRAINT "WorkoutSet_workoutSessionExerciseId_fkey";
- -- DropTable
- DROP TABLE "WorkoutSession";
- -- DropTable
- DROP TABLE "WorkoutSessionExercise";
- -- DropTable
- DROP TABLE "WorkoutSet";
- -- CreateTable
- CREATE TABLE "workout_sessions" (
- "id" TEXT NOT NULL,
- "userId" TEXT NOT NULL,
- "startedAt" TIMESTAMP(3) NOT NULL,
- "endedAt" TIMESTAMP(3),
- "duration" INTEGER,
- CONSTRAINT "workout_sessions_pkey" PRIMARY KEY ("id")
- );
- -- CreateTable
- CREATE TABLE "workout_session_exercises" (
- "id" TEXT NOT NULL,
- "workoutSessionId" TEXT NOT NULL,
- "exerciseId" TEXT NOT NULL,
- "order" INTEGER NOT NULL,
- CONSTRAINT "workout_session_exercises_pkey" PRIMARY KEY ("id")
- );
- -- CreateTable
- CREATE TABLE "workout_sets" (
- "id" TEXT NOT NULL,
- "workoutSessionExerciseId" TEXT NOT NULL,
- "setIndex" INTEGER NOT NULL,
- "type" "WorkoutSetType" NOT NULL,
- "types" "WorkoutSetType"[] DEFAULT ARRAY[]::"WorkoutSetType"[],
- "valueInt" INTEGER,
- "valuesInt" INTEGER[] DEFAULT ARRAY[]::INTEGER[],
- "valueSec" INTEGER,
- "valuesSec" INTEGER[] DEFAULT ARRAY[]::INTEGER[],
- "unit" "WorkoutSetUnit",
- "units" "WorkoutSetUnit"[] DEFAULT ARRAY[]::"WorkoutSetUnit"[],
- "completed" BOOLEAN NOT NULL DEFAULT false,
- CONSTRAINT "workout_sets_pkey" PRIMARY KEY ("id")
- );
- -- AddForeignKey
- ALTER TABLE "workout_sessions" ADD CONSTRAINT "workout_sessions_userId_fkey" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
- -- AddForeignKey
- ALTER TABLE "workout_session_exercises" ADD CONSTRAINT "workout_session_exercises_workoutSessionId_fkey" FOREIGN KEY ("workoutSessionId") REFERENCES "workout_sessions"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
- -- AddForeignKey
- ALTER TABLE "workout_session_exercises" ADD CONSTRAINT "workout_session_exercises_exerciseId_fkey" FOREIGN KEY ("exerciseId") REFERENCES "exercises"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
- -- AddForeignKey
- ALTER TABLE "workout_sets" ADD CONSTRAINT "workout_sets_workoutSessionExerciseId_fkey" FOREIGN KEY ("workoutSessionExerciseId") REFERENCES "workout_session_exercises"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|