Skip to content

Commit

Permalink
Merge pull request #6 from AloyBranCheung/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
AloyBranCheung authored Nov 8, 2023
2 parents 2e4f4c1 + ecef44f commit 86079c0
Show file tree
Hide file tree
Showing 42 changed files with 789 additions and 620 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ Debugging:

- make sure you are not ip banned on the supabase admin dashboard (if you failed to login)

## Dev

- Visualize your prisma schema [with this](https://github.com/Ovyerus/prismaliser)

## Prisma

https://www.prisma.io/docs/concepts/components/prisma-migrate/mental-model
Expand All @@ -47,6 +51,7 @@ https://www.prisma.io/docs/concepts/components/prisma-migrate/mental-model
## Resources

- [Figma](https://www.figma.com/file/R0i3v0IsjhkOhDSYITeWHU/Workout-App?type=design&node-id=0%3A1&mode=design&t=4R5sghDXxfNWkufE-1)
- [FigJam](https://www.figma.com/file/juzdl3w9WAAFb52uKXQNBr/Active-Workout-System-Design?type=whiteboard&node-id=0-1&t=Tcm4iRRwaxpdOEp9-0)

## Notes to self

Expand Down
7 changes: 7 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
services:
nextjs:
container_name: workout-app
build:
dockerfile: ./Dockerfile.dev
ports:
Expand All @@ -8,3 +9,9 @@ services:
- ./.env
volumes:
- ./src:/app/src
prismaliser:
container_name: prismaliser
build:
dockerfile: ./prismaliser/Dockerfile.dev
ports:
- "8080:8080"
133 changes: 0 additions & 133 deletions prisma/db-diagram-io.dbml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
Warnings:
- Added the required column `unit` to the `Exercise` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "Exercise" ADD COLUMN "unit" TEXT NOT NULL;
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
Warnings:
- Added the required column `gymId` to the `Exercise` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "Exercise" ADD COLUMN "gymId" UUID NOT NULL;

-- AddForeignKey
ALTER TABLE "Exercise" ADD CONSTRAINT "Exercise_gymId_fkey" FOREIGN KEY ("gymId") REFERENCES "GymLocation"("gymId") ON DELETE CASCADE ON UPDATE CASCADE;
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
Warnings:
- You are about to drop the column `exerciseOrder` on the `Session` table. All the data in the column will be lost.
- You are about to drop the column `duration` on the `WorkoutPlan` table. All the data in the column will be lost.
- You are about to drop the column `lastWorkout` on the `WorkoutPlan` table. All the data in the column will be lost.
- A unique constraint covering the columns `[exerciseId]` on the table `Target` will be added. If there are existing duplicate values, this will fail.
*/
-- AlterTable
ALTER TABLE "Session" DROP COLUMN "exerciseOrder";

-- AlterTable
ALTER TABLE "WorkoutPlan" DROP COLUMN "duration",
DROP COLUMN "lastWorkout";

-- CreateTable
CREATE TABLE "CurrActiveSesh" (
"actSeshId" UUID NOT NULL,
"duration" INTEGER NOT NULL,
"sessionId" UUID NOT NULL,
"userId" TEXT NOT NULL,

CONSTRAINT "CurrActiveSesh_pkey" PRIMARY KEY ("actSeshId")
);

-- CreateIndex
CREATE UNIQUE INDEX "CurrActiveSesh_actSeshId_key" ON "CurrActiveSesh"("actSeshId");

-- CreateIndex
CREATE UNIQUE INDEX "CurrActiveSesh_sessionId_key" ON "CurrActiveSesh"("sessionId");

-- CreateIndex
CREATE UNIQUE INDEX "CurrActiveSesh_userId_key" ON "CurrActiveSesh"("userId");

-- CreateIndex
CREATE UNIQUE INDEX "Target_exerciseId_key" ON "Target"("exerciseId");

-- AddForeignKey
ALTER TABLE "CurrActiveSesh" ADD CONSTRAINT "CurrActiveSesh_sessionId_fkey" FOREIGN KEY ("sessionId") REFERENCES "Session"("sessionId") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "CurrActiveSesh" ADD CONSTRAINT "CurrActiveSesh_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("userId") ON DELETE RESTRICT ON UPDATE CASCADE;
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
Warnings:
- You are about to drop the column `duration` on the `CurrActiveSesh` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "CurrActiveSesh" DROP COLUMN "duration",
ADD COLUMN "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
ADD COLUMN "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP;

-- AlterTable
ALTER TABLE "GymLocation" ADD COLUMN "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
ADD COLUMN "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP;
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
Warnings:
- You are about to drop the column `exerciseOrder` on the `WorkoutPlan` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "WorkoutPlan" DROP COLUMN "exerciseOrder",
ADD COLUMN "duration" INTEGER,
ADD COLUMN "lastWorkout" TIMESTAMP(3);
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "WorkoutPlan" ADD COLUMN "exerciseOrder" TEXT[];
24 changes: 24 additions & 0 deletions prisma/migrations/20231108124226_remove_target_table/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
Warnings:
- You are about to drop the `Target` table. If the table is not empty, all the data it contains will be lost.
- Added the required column `targetReps` to the `Exercise` table without a default value. This is not possible if the table is not empty.
- Added the required column `targetSets` to the `Exercise` table without a default value. This is not possible if the table is not empty.
- Added the required column `weightUnit` to the `Set` table without a default value. This is not possible if the table is not empty.
*/
-- DropForeignKey
ALTER TABLE "Target" DROP CONSTRAINT "Target_exerciseId_fkey";

-- DropForeignKey
ALTER TABLE "Target" DROP CONSTRAINT "Target_planId_fkey";

-- AlterTable
ALTER TABLE "Exercise" ADD COLUMN "targetReps" INTEGER NOT NULL,
ADD COLUMN "targetSets" INTEGER NOT NULL;

-- AlterTable
ALTER TABLE "Set" ADD COLUMN "weightUnit" TEXT NOT NULL;

-- DropTable
DROP TABLE "Target";
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- AlterTable
ALTER TABLE "Exercise" ALTER COLUMN "targetReps" DROP NOT NULL,
ALTER COLUMN "targetSets" DROP NOT NULL;
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
Warnings:
- You are about to drop the column `duration` on the `Session` table. All the data in the column will be lost.
- Added the required column `endDuration` to the `Session` table without a default value. This is not possible if the table is not empty.
- Added the required column `startDuration` to the `Session` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "Session" DROP COLUMN "duration",
ADD COLUMN "endDuration" TIMESTAMP(3) NOT NULL,
ADD COLUMN "startDuration" TIMESTAMP(3) NOT NULL;
Loading

0 comments on commit 86079c0

Please sign in to comment.