stremio/apps/master-api/prisma/migrations/20260907120000_viewer_favorites/migration.sql
Jos Vooges | STH cf9cdd43db Add server-synced viewer favorites for cross-device bookmarks.
Per-profile favorites API and migration so clients can share bookmarks after Dokploy deploy.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 15:43:37 +02:00

22 lines
862 B
SQL

-- CreateEnum
CREATE TYPE "FavoriteMediaType" AS ENUM ('MOVIE', 'SERIES');
-- CreateTable
CREATE TABLE "viewer_favorites" (
"id" TEXT NOT NULL,
"profile_id" TEXT NOT NULL,
"media_type" "FavoriteMediaType" NOT NULL,
"media_id" TEXT NOT NULL,
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "viewer_favorites_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE INDEX "viewer_favorites_profile_id_created_at_idx" ON "viewer_favorites"("profile_id", "created_at");
-- CreateIndex
CREATE UNIQUE INDEX "viewer_favorites_profile_id_media_type_media_id_key" ON "viewer_favorites"("profile_id", "media_type", "media_id");
-- AddForeignKey
ALTER TABLE "viewer_favorites" ADD CONSTRAINT "viewer_favorites_profile_id_fkey" FOREIGN KEY ("profile_id") REFERENCES "viewer_profiles"("id") ON DELETE CASCADE ON UPDATE CASCADE;