traintrape-moi/server/prisma/migrations/20241214115916_on_delete/migration.sql

42 lines
1.8 KiB
SQL

-- DropForeignKey
ALTER TABLE "ChallengeAction" DROP CONSTRAINT "ChallengeAction_challengeId_fkey";
-- DropForeignKey
ALTER TABLE "Geolocation" DROP CONSTRAINT "Geolocation_playerId_fkey";
-- DropForeignKey
ALTER TABLE "MoneyUpdate" DROP CONSTRAINT "MoneyUpdate_actionId_fkey";
-- DropForeignKey
ALTER TABLE "MoneyUpdate" DROP CONSTRAINT "MoneyUpdate_runId_fkey";
-- DropForeignKey
ALTER TABLE "MoneyUpdate" DROP CONSTRAINT "MoneyUpdate_tripId_fkey";
-- DropForeignKey
ALTER TABLE "PlayerRun" DROP CONSTRAINT "PlayerRun_gameId_fkey";
-- DropForeignKey
ALTER TABLE "PlayerRun" DROP CONSTRAINT "PlayerRun_runnerId_fkey";
-- AddForeignKey
ALTER TABLE "PlayerRun" ADD CONSTRAINT "PlayerRun_gameId_fkey" FOREIGN KEY ("gameId") REFERENCES "Game"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "PlayerRun" ADD CONSTRAINT "PlayerRun_runnerId_fkey" FOREIGN KEY ("runnerId") REFERENCES "Player"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Geolocation" ADD CONSTRAINT "Geolocation_playerId_fkey" FOREIGN KEY ("playerId") REFERENCES "Player"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "ChallengeAction" ADD CONSTRAINT "ChallengeAction_challengeId_fkey" FOREIGN KEY ("challengeId") REFERENCES "Challenge"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "MoneyUpdate" ADD CONSTRAINT "MoneyUpdate_actionId_fkey" FOREIGN KEY ("actionId") REFERENCES "ChallengeAction"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "MoneyUpdate" ADD CONSTRAINT "MoneyUpdate_tripId_fkey" FOREIGN KEY ("tripId") REFERENCES "TrainTrip"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "MoneyUpdate" ADD CONSTRAINT "MoneyUpdate_runId_fkey" FOREIGN KEY ("runId") REFERENCES "PlayerRun"("id") ON DELETE CASCADE ON UPDATE CASCADE;