-
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.
- Loading branch information
Showing
2 changed files
with
105 additions
and
3 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
prisma/migrations/20240911232815_stats_datamodel/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,52 @@ | ||
-- CreateEnum | ||
CREATE TYPE "StatisticType" AS ENUM ('VALUE', 'TRANSACTION'); | ||
|
||
-- AlterTable | ||
ALTER TABLE "Template" ALTER COLUMN "motd" SET DEFAULT ' &e&lEFREI CRAFT &8• &61.19.3 | ||
&bBienvenue !'; | ||
|
||
-- CreateTable | ||
CREATE TABLE "Statistic" ( | ||
"id" TEXT NOT NULL, | ||
"key" TEXT NOT NULL, | ||
"displayName" TEXT, | ||
"color" TEXT NOT NULL DEFAULT '&7', | ||
"type" "StatisticType" NOT NULL DEFAULT 'TRANSACTION', | ||
|
||
CONSTRAINT "Statistic_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "PlayerStatisticTransaction" ( | ||
"id" TEXT NOT NULL, | ||
"playerUuid" TEXT NOT NULL, | ||
"statisticId" TEXT NOT NULL, | ||
"value" INTEGER NOT NULL, | ||
"reason" TEXT, | ||
"timestamp" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
|
||
CONSTRAINT "PlayerStatisticTransaction_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "PlayerStatisticValue" ( | ||
"id" TEXT NOT NULL, | ||
"playerUuid" TEXT NOT NULL, | ||
"statisticId" TEXT NOT NULL, | ||
"value" INTEGER NOT NULL, | ||
"updatedAt" TIMESTAMP(3) NOT NULL, | ||
|
||
CONSTRAINT "PlayerStatisticValue_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "PlayerStatisticTransaction" ADD CONSTRAINT "PlayerStatisticTransaction_playerUuid_fkey" FOREIGN KEY ("playerUuid") REFERENCES "Player"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "PlayerStatisticTransaction" ADD CONSTRAINT "PlayerStatisticTransaction_statisticId_fkey" FOREIGN KEY ("statisticId") REFERENCES "Statistic"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "PlayerStatisticValue" ADD CONSTRAINT "PlayerStatisticValue_playerUuid_fkey" FOREIGN KEY ("playerUuid") REFERENCES "Player"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "PlayerStatisticValue" ADD CONSTRAINT "PlayerStatisticValue_statisticId_fkey" FOREIGN KEY ("statisticId") REFERENCES "Statistic"("id") ON DELETE RESTRICT 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