exploring/fighting is functional
[sketchy-heroes.git] / prisma / migrations / 20220315145640_relation_unrename / migration.sql
diff --git a/prisma/migrations/20220315145640_relation_unrename/migration.sql b/prisma/migrations/20220315145640_relation_unrename/migration.sql
new file mode 100644 (file)
index 0000000..1e6c5ce
--- /dev/null
@@ -0,0 +1,128 @@
+/*
+  Warnings:
+
+  - You are about to drop the `auth_token` table. If the table is not empty, all the data it contains will be lost.
+  - You are about to drop the `monster` table. If the table is not empty, all the data it contains will be lost.
+  - You are about to drop the `monster_biome` table. If the table is not empty, all the data it contains will be lost.
+  - You are about to drop the `player` table. If the table is not empty, all the data it contains will be lost.
+  - You are about to drop the `zone_biome` table. If the table is not empty, all the data it contains will be lost.
+
+*/
+-- CreateEnum
+CREATE TYPE "Biome" AS ENUM ('PLAINS', 'FIELDS', 'WOODLAND', 'FOREST', 'SWAMP', 'TUNDRA', 'MOUNTAIN', 'CAVE', 'DESERT');
+
+-- CreateEnum
+CREATE TYPE "MonsterType" AS ENUM ('BEAST', 'FLYING', 'HUMANOID', 'GIANT', 'INSECT', 'UNDEAD');
+
+-- DropForeignKey
+ALTER TABLE "auth_token" DROP CONSTRAINT "auth_token_playerId_fkey";
+
+-- DropForeignKey
+ALTER TABLE "monster_biome" DROP CONSTRAINT "monster_biome_monsterId_fkey";
+
+-- DropForeignKey
+ALTER TABLE "player" DROP CONSTRAINT "player_zoneBiomeId_fkey";
+
+-- DropTable
+DROP TABLE "auth_token";
+
+-- DropTable
+DROP TABLE "monster";
+
+-- DropTable
+DROP TABLE "monster_biome";
+
+-- DropTable
+DROP TABLE "player";
+
+-- DropTable
+DROP TABLE "zone_biome";
+
+-- DropEnum
+DROP TYPE "biome";
+
+-- DropEnum
+DROP TYPE "monster_type";
+
+-- CreateTable
+CREATE TABLE "ZoneBiomes" (
+    "id" UUID NOT NULL,
+    "playerId" UUID,
+    "biome" "Biome" NOT NULL,
+    "maxSteps" INTEGER NOT NULL DEFAULT 500,
+
+    CONSTRAINT "ZoneBiomes_pkey" PRIMARY KEY ("id")
+);
+
+-- CreateTable
+CREATE TABLE "Player" (
+    "id" UUID NOT NULL,
+    "username" TEXT NOT NULL,
+    "password" TEXT NOT NULL,
+    "level" INTEGER NOT NULL DEFAULT 1,
+    "currency" INTEGER NOT NULL DEFAULT 0,
+    "pow" INTEGER NOT NULL,
+    "zest" INTEGER NOT NULL,
+    "woosh" INTEGER NOT NULL,
+    "luck" INTEGER NOT NULL,
+    "aha" INTEGER NOT NULL,
+    "wow" INTEGER NOT NULL,
+    "stamina" INTEGER NOT NULL,
+    "hp" INTEGER NOT NULL,
+    "statPoints" INTEGER NOT NULL DEFAULT 0,
+    "exp" INTEGER NOT NULL DEFAULT 0,
+    "zoneBiomeId" UUID NOT NULL,
+    "steps" INTEGER NOT NULL DEFAULT 0,
+
+    CONSTRAINT "Player_pkey" PRIMARY KEY ("id")
+);
+
+-- CreateTable
+CREATE TABLE "AuthToken" (
+    "token" UUID NOT NULL,
+    "playerId" UUID NOT NULL,
+    "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
+    "updatedAt" TIMESTAMP(3),
+
+    CONSTRAINT "AuthToken_pkey" PRIMARY KEY ("token")
+);
+
+-- CreateTable
+CREATE TABLE "Monster" (
+    "id" UUID NOT NULL,
+    "name" TEXT NOT NULL,
+    "monsterType" "MonsterType"[],
+
+    CONSTRAINT "Monster_pkey" PRIMARY KEY ("id")
+);
+
+-- CreateTable
+CREATE TABLE "MonsterBiome" (
+    "monsterId" UUID NOT NULL,
+    "biome" "Biome" NOT NULL,
+    "weight" DECIMAL(65,30) NOT NULL,
+    "time" JSONB NOT NULL,
+
+    CONSTRAINT "MonsterBiome_pkey" PRIMARY KEY ("monsterId","biome")
+);
+
+-- CreateIndex
+CREATE UNIQUE INDEX "Player_username_key" ON "Player"("username");
+
+-- CreateIndex
+CREATE UNIQUE INDEX "Player_zoneBiomeId_key" ON "Player"("zoneBiomeId");
+
+-- CreateIndex
+CREATE UNIQUE INDEX "AuthToken_playerId_key" ON "AuthToken"("playerId");
+
+-- CreateIndex
+CREATE UNIQUE INDEX "Monster_name_key" ON "Monster"("name");
+
+-- AddForeignKey
+ALTER TABLE "Player" ADD CONSTRAINT "Player_zoneBiomeId_fkey" FOREIGN KEY ("zoneBiomeId") REFERENCES "ZoneBiomes"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
+
+-- AddForeignKey
+ALTER TABLE "AuthToken" ADD CONSTRAINT "AuthToken_playerId_fkey" FOREIGN KEY ("playerId") REFERENCES "Player"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
+
+-- AddForeignKey
+ALTER TABLE "MonsterBiome" ADD CONSTRAINT "MonsterBiome_monsterId_fkey" FOREIGN KEY ("monsterId") REFERENCES "Monster"("id") ON DELETE RESTRICT ON UPDATE CASCADE;