-- CreateEnum
CREATE TYPE "QuestType" AS ENUM ('ONE_TIME', 'DAY', 'WEEK', 'MONTH', 'UNLIMITED');

-- CreateTable
CREATE TABLE "quest" (
    "id" TEXT NOT NULL,
    "type" "QuestType" NOT NULL DEFAULT 'UNLIMITED',
    "description" TEXT NOT NULL,

    CONSTRAINT "quest_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "quest_log" (
    "id" TEXT NOT NULL,
    "quest_id" TEXT NOT NULL,
    "userId" TEXT NOT NULL,
    "completedAt" TIMESTAMP(3) NOT NULL,

    CONSTRAINT "quest_log_pkey" PRIMARY KEY ("id")
);

-- AddForeignKey
ALTER TABLE "quest_log" ADD CONSTRAINT "quest_log_quest_id_fkey" FOREIGN KEY ("quest_id") REFERENCES "quest"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "quest_log" ADD CONSTRAINT "quest_log_userId_fkey" FOREIGN KEY ("userId") REFERENCES "account"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
