-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add foreign keys and remove unused indices and columns
- Loading branch information
1 parent
d023599
commit 9faacc3
Showing
2 changed files
with
86 additions
and
25 deletions.
There are no files selected for viewing
83 changes: 83 additions & 0 deletions
83
prisma/migrations/20240317234533_add_foreign_keys/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/* | ||
Warnings: | ||
- You are about to drop the column `caseId` on the `Algorithm` table. All the data in the column will be lost. | ||
*/ | ||
-- DropIndex | ||
DROP INDEX "Account_userId_idx"; | ||
|
||
-- DropIndex | ||
DROP INDEX "Algorithm_caseId_idx"; | ||
|
||
-- DropIndex | ||
DROP INDEX "AlgorithmsForCase_algorithmId_idx"; | ||
|
||
-- DropIndex | ||
DROP INDEX "AlgorithmsForCase_caseId_idx"; | ||
|
||
-- DropIndex | ||
DROP INDEX "Case_puzzleId_idx"; | ||
|
||
-- DropIndex | ||
DROP INDEX "Method_puzzleId_idx"; | ||
|
||
-- DropIndex | ||
DROP INDEX "Method_visualizationId_idx"; | ||
|
||
-- DropIndex | ||
DROP INDEX "Puzzle_visualizationId_idx"; | ||
|
||
-- DropIndex | ||
DROP INDEX "Session_userId_idx"; | ||
|
||
-- DropIndex | ||
DROP INDEX "Set_puzzleId_idx"; | ||
|
||
-- DropIndex | ||
DROP INDEX "Set_visualizationId_idx"; | ||
|
||
-- AlterTable | ||
ALTER TABLE "Algorithm" DROP COLUMN "caseId"; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Account" ADD CONSTRAINT "Account_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Session" ADD CONSTRAINT "Session_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Puzzle" ADD CONSTRAINT "Puzzle_visualizationId_fkey" FOREIGN KEY ("visualizationId") REFERENCES "Visualization"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Set" ADD CONSTRAINT "Set_puzzleId_fkey" FOREIGN KEY ("puzzleId") REFERENCES "Puzzle"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Set" ADD CONSTRAINT "Set_visualizationId_fkey" FOREIGN KEY ("visualizationId") REFERENCES "Visualization"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Case" ADD CONSTRAINT "Case_puzzleId_fkey" FOREIGN KEY ("puzzleId") REFERENCES "Puzzle"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "AlgorithmsForCase" ADD CONSTRAINT "AlgorithmsForCase_algorithmId_fkey" FOREIGN KEY ("algorithmId") REFERENCES "Algorithm"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "AlgorithmsForCase" ADD CONSTRAINT "AlgorithmsForCase_caseId_fkey" FOREIGN KEY ("caseId") REFERENCES "Case"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Method" ADD CONSTRAINT "Method_puzzleId_fkey" FOREIGN KEY ("puzzleId") REFERENCES "Puzzle"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Method" ADD CONSTRAINT "Method_visualizationId_fkey" FOREIGN KEY ("visualizationId") REFERENCES "Visualization"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "_CaseToSet" ADD CONSTRAINT "_CaseToSet_A_fkey" FOREIGN KEY ("A") REFERENCES "Case"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "_CaseToSet" ADD CONSTRAINT "_CaseToSet_B_fkey" FOREIGN KEY ("B") REFERENCES "Set"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "_MethodToSet" ADD CONSTRAINT "_MethodToSet_A_fkey" FOREIGN KEY ("A") REFERENCES "Method"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "_MethodToSet" ADD CONSTRAINT "_MethodToSet_B_fkey" FOREIGN KEY ("B") REFERENCES "Set"("id") ON DELETE CASCADE ON UPDATE CASCADE; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters