-- DropForeignKey
ALTER TABLE "NotificationLog" DROP CONSTRAINT "NotificationLog_userId_fkey";

-- AlterTable
ALTER TABLE "NotificationLog" ADD COLUMN     "batchId" TEXT,
ADD COLUMN     "email" TEXT,
ADD COLUMN     "projectId" TEXT,
ADD COLUMN     "roundId" TEXT,
ALTER COLUMN "userId" DROP NOT NULL,
ALTER COLUMN "channel" SET DEFAULT 'EMAIL';

-- CreateIndex
CREATE INDEX "NotificationLog_roundId_type_idx" ON "NotificationLog"("roundId", "type");

-- CreateIndex
CREATE INDEX "NotificationLog_projectId_idx" ON "NotificationLog"("projectId");

-- CreateIndex
CREATE INDEX "NotificationLog_batchId_idx" ON "NotificationLog"("batchId");

-- CreateIndex
CREATE INDEX "NotificationLog_email_idx" ON "NotificationLog"("email");

-- AddForeignKey
ALTER TABLE "NotificationLog" ADD CONSTRAINT "NotificationLog_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "NotificationLog" ADD CONSTRAINT "NotificationLog_roundId_fkey" FOREIGN KEY ("roundId") REFERENCES "Round"("id") ON DELETE SET NULL ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "NotificationLog" ADD CONSTRAINT "NotificationLog_projectId_fkey" FOREIGN KEY ("projectId") REFERENCES "Project"("id") ON DELETE SET NULL ON UPDATE CASCADE;
