proc-gen equipment drops from monsters can be picked up
[sketchy-heroes.git] / prisma / migrations / 20220318060910_id_on_monster_biome / migration.sql
diff --git a/prisma/migrations/20220318060910_id_on_monster_biome/migration.sql b/prisma/migrations/20220318060910_id_on_monster_biome/migration.sql
new file mode 100644 (file)
index 0000000..777ee4c
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+  Warnings:
+
+  - You are about to drop the column `dropRate` on the `Monster` table. All the data in the column will be lost.
+  - The primary key for the `MonsterBiome` table will be changed. If it partially fails, the table could be left without primary key constraint.
+  - A unique constraint covering the columns `[monsterId,biome]` on the table `MonsterBiome` will be added. If there are existing duplicate values, this will fail.
+  - The required column `id` was added to the `MonsterBiome` table with a prisma-level default value. This is not possible if the table is not empty. Please add this column as optional, then populate it before making it required.
+
+*/
+-- AlterTable
+ALTER TABLE "Monster" DROP COLUMN "dropRate";
+
+-- AlterTable
+ALTER TABLE "MonsterBiome" DROP CONSTRAINT "MonsterBiome_pkey",
+ADD COLUMN     "dropRate" DECIMAL(65,30) NOT NULL DEFAULT 0.1,
+ADD COLUMN     "id" UUID NOT NULL,
+ADD CONSTRAINT "MonsterBiome_pkey" PRIMARY KEY ("id");
+
+-- CreateTable
+CREATE TABLE "LootTable" (
+    "monsterBiomeId" UUID NOT NULL,
+    "itemId" UUID NOT NULL,
+    "dropRate" DECIMAL(65,30) NOT NULL,
+
+    CONSTRAINT "LootTable_pkey" PRIMARY KEY ("monsterBiomeId","itemId")
+);
+
+-- CreateIndex
+CREATE UNIQUE INDEX "MonsterBiome_monsterId_biome_key" ON "MonsterBiome"("monsterId", "biome");
+
+-- AddForeignKey
+ALTER TABLE "LootTable" ADD CONSTRAINT "LootTable_itemId_fkey" FOREIGN KEY ("itemId") REFERENCES "Item"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
+
+-- AddForeignKey
+ALTER TABLE "LootTable" ADD CONSTRAINT "LootTable_monsterBiomeId_fkey" FOREIGN KEY ("monsterBiomeId") REFERENCES "MonsterBiome"("id") ON DELETE RESTRICT ON UPDATE CASCADE;