-- CreateTable
CREATE TABLE "DealSave" (
    "userId" INTEGER NOT NULL,
    "dealId" INTEGER NOT NULL,
    "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,

    CONSTRAINT "DealSave_pkey" PRIMARY KEY ("userId","dealId")
);

-- CreateIndex
CREATE INDEX "DealSave_userId_createdAt_idx" ON "DealSave"("userId", "createdAt");

-- CreateIndex
CREATE INDEX "DealSave_dealId_idx" ON "DealSave"("dealId");

-- CreateIndex
CREATE INDEX "Comment_userId_createdAt_idx" ON "Comment"("userId", "createdAt");

-- AddForeignKey
ALTER TABLE "DealSave" ADD CONSTRAINT "DealSave_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "DealSave" ADD CONSTRAINT "DealSave_dealId_fkey" FOREIGN KEY ("dealId") REFERENCES "Deal"("id") ON DELETE CASCADE ON UPDATE CASCADE;
