proc-gen equipment drops from monsters can be picked up
[sketchy-heroes.git] / prisma / migrations / 20220317054135_create_item_config / migration.sql
diff --git a/prisma/migrations/20220317054135_create_item_config/migration.sql b/prisma/migrations/20220317054135_create_item_config/migration.sql
new file mode 100644 (file)
index 0000000..0c4b935
--- /dev/null
@@ -0,0 +1,41 @@
+-- CreateEnum
+CREATE TYPE "InventoryType" AS ENUM ('HELM', 'R_SHOULDER', 'L_SHOULDER', 'TORSO', 'R_ARM', 'L_ARM', 'LEGS', 'L_FOOT', 'R_FOOT');
+
+-- CreateEnum
+CREATE TYPE "Rarity" AS ENUM ('COMMON', 'UNCOMMON', 'RARE');
+
+-- CreateTable
+CREATE TABLE "Item" (
+    "id" UUID NOT NULL,
+    "name" TEXT NOT NULL,
+    "type" "InventoryType"[],
+    "durability" INTEGER NOT NULL DEFAULT 0,
+    "minLevelDrop" INTEGER NOT NULL DEFAULT 1,
+    "availableRarity" "Rarity"[],
+    "statModifiers" JSONB NOT NULL,
+
+    CONSTRAINT "Item_pkey" PRIMARY KEY ("id")
+);
+
+-- CreateTable
+CREATE TABLE "Inventory" (
+    "id" UUID NOT NULL,
+    "playerId" UUID NOT NULL,
+    "itemId" UUID NOT NULL,
+    "maxDurability" INTEGER NOT NULL DEFAULT 1,
+    "currentDurability" INTEGER NOT NULL DEFAULT 1,
+    "type" "InventoryType"[],
+    "statModifiers" JSONB NOT NULL,
+    "stackable" BOOLEAN NOT NULL DEFAULT false,
+
+    CONSTRAINT "Inventory_pkey" PRIMARY KEY ("id")
+);
+
+-- CreateIndex
+CREATE UNIQUE INDEX "Item_name_key" ON "Item"("name");
+
+-- AddForeignKey
+ALTER TABLE "Inventory" ADD CONSTRAINT "Inventory_playerId_fkey" FOREIGN KEY ("playerId") REFERENCES "Player"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
+
+-- AddForeignKey
+ALTER TABLE "Inventory" ADD CONSTRAINT "Inventory_itemId_fkey" FOREIGN KEY ("itemId") REFERENCES "Item"("id") ON DELETE RESTRICT ON UPDATE CASCADE;