Initial commit

This commit is contained in:
twotalesanimation
2026-06-11 10:46:09 +02:00
commit 81ad7e4ea9
223 changed files with 39530 additions and 0 deletions
@@ -0,0 +1,33 @@
-- CreateTable
CREATE TABLE "VideoWatchSegment" (
"id" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"videoId" TEXT NOT NULL,
"startSec" INTEGER NOT NULL,
"endSec" INTEGER NOT NULL,
"watchedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "VideoWatchSegment_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE INDEX "VideoWatchSegment_userId_videoId_idx" ON "VideoWatchSegment"("userId", "videoId");
-- CreateIndex
CREATE INDEX "VideoWatchSegment_watchedAt_idx" ON "VideoWatchSegment"("watchedAt");
-- CreateIndex
CREATE INDEX "VideoWatchSegment_userId_idx" ON "VideoWatchSegment"("userId");
-- CreateIndex
CREATE INDEX "VideoWatchSegment_videoId_idx" ON "VideoWatchSegment"("videoId");
-- AddForeignKey
ALTER TABLE "VideoWatchSegment" ADD CONSTRAINT "VideoWatchSegment_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "VideoWatchSegment" ADD CONSTRAINT "VideoWatchSegment_videoId_fkey" FOREIGN KEY ("videoId") REFERENCES "Video"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "VideoWatchSegment" ADD CONSTRAINT "VideoWatchSegment_userId_videoId_fkey" FOREIGN KEY ("userId", "videoId") REFERENCES "VideoProgress"("userId", "videoId") ON DELETE CASCADE ON UPDATE CASCADE;