From e19b522c275c6b984c9485da3a5b83c50fbc9b48 Mon Sep 17 00:00:00 2001 From: Kneesal Date: Thu, 5 Feb 2026 00:06:42 +0000 Subject: [PATCH 1/3] fix: add user media profile --- libs/prisma/media/db/schema.prisma | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/libs/prisma/media/db/schema.prisma b/libs/prisma/media/db/schema.prisma index f31a84120f1..8a7e7181cbd 100644 --- a/libs/prisma/media/db/schema.prisma +++ b/libs/prisma/media/db/schema.prisma @@ -167,6 +167,7 @@ model Video { publishedAt DateTime? createdAt DateTime @default(now()) updatedAt DateTime @default(now()) @updatedAt + userMediaProfiles UserMediaProfile[] @@index(label) @@index(childIds) @@ -272,7 +273,7 @@ model VideoEdition { } model VideoSubtitle { - id String @id @default(uuid()) + id String @id @default(uuid()) videoId String edition String @default("base") vttAssetId String? @unique @@ -528,6 +529,16 @@ model UserMediaRole { updatedAt DateTime @default(now()) @updatedAt } +model UserMediaProfile { + id String @id @default(uuid()) + userId String + userInterests Video[] + notificationLanguages String[] + notificationCountries String[] + createdAt DateTime @default(now()) + updatedAt DateTime @default(now()) @updatedAt +} + model ShortLinkDomain { id String @id @default(uuid()) /// the hostname including subdomain, domain, and TLD, but excluding port @@ -567,9 +578,9 @@ model ShortLink { model ShortLinkBlocklistDomain { /// the hostname including subdomain, domain, and TLD, but excluding port - hostname String @id - createdAt DateTime @default(now()) - updatedAt DateTime @default(now()) @updatedAt + hostname String @id + createdAt DateTime @default(now()) + updatedAt DateTime @default(now()) @updatedAt } model VideoOrigin { From 0cefebb2e798de18b58d620ddd7f57a44cacb066 Mon Sep 17 00:00:00 2001 From: Kneesal Date: Thu, 5 Feb 2026 00:07:21 +0000 Subject: [PATCH 2/3] fix: change naming --- libs/prisma/media/db/schema.prisma | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/libs/prisma/media/db/schema.prisma b/libs/prisma/media/db/schema.prisma index 8a7e7181cbd..3c525f74550 100644 --- a/libs/prisma/media/db/schema.prisma +++ b/libs/prisma/media/db/schema.prisma @@ -530,13 +530,13 @@ model UserMediaRole { } model UserMediaProfile { - id String @id @default(uuid()) - userId String - userInterests Video[] - notificationLanguages String[] - notificationCountries String[] - createdAt DateTime @default(now()) - updatedAt DateTime @default(now()) @updatedAt + id String @id @default(uuid()) + userId String + userInterests Video[] + languageInterests String[] + countryInterests String[] + createdAt DateTime @default(now()) + updatedAt DateTime @default(now()) @updatedAt } model ShortLinkDomain { From 19f24bfa2c212b330aeab7959137aefdd5e91cec Mon Sep 17 00:00:00 2001 From: Kneesal Date: Thu, 5 Feb 2026 01:53:32 +0000 Subject: [PATCH 3/3] fix: migrations --- .../migration.sql | 28 +++++++++++++++++ libs/prisma/media/db/schema.prisma | 14 ++++----- .../media/src/__generated__/pothos-types.ts | 31 +++++++++++++++++-- 3 files changed, 63 insertions(+), 10 deletions(-) create mode 100644 libs/prisma/media/db/migrations/20260205015244_20260205015242/migration.sql diff --git a/libs/prisma/media/db/migrations/20260205015244_20260205015242/migration.sql b/libs/prisma/media/db/migrations/20260205015244_20260205015242/migration.sql new file mode 100644 index 00000000000..26c86424418 --- /dev/null +++ b/libs/prisma/media/db/migrations/20260205015244_20260205015242/migration.sql @@ -0,0 +1,28 @@ +-- CreateTable +CREATE TABLE "UserMediaProfile" ( + "id" TEXT NOT NULL, + "userId" TEXT NOT NULL, + "languageInterestIds" TEXT[], + "countryInterestIds" TEXT[], + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + + CONSTRAINT "UserMediaProfile_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "_UserMediaProfileToVideo" ( + "A" TEXT NOT NULL, + "B" TEXT NOT NULL, + + CONSTRAINT "_UserMediaProfileToVideo_AB_pkey" PRIMARY KEY ("A","B") +); + +-- CreateIndex +CREATE INDEX "_UserMediaProfileToVideo_B_index" ON "_UserMediaProfileToVideo"("B"); + +-- AddForeignKey +ALTER TABLE "_UserMediaProfileToVideo" ADD CONSTRAINT "_UserMediaProfileToVideo_A_fkey" FOREIGN KEY ("A") REFERENCES "UserMediaProfile"("id") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "_UserMediaProfileToVideo" ADD CONSTRAINT "_UserMediaProfileToVideo_B_fkey" FOREIGN KEY ("B") REFERENCES "Video"("id") ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/libs/prisma/media/db/schema.prisma b/libs/prisma/media/db/schema.prisma index 3c525f74550..914585eb8fa 100644 --- a/libs/prisma/media/db/schema.prisma +++ b/libs/prisma/media/db/schema.prisma @@ -530,13 +530,13 @@ model UserMediaRole { } model UserMediaProfile { - id String @id @default(uuid()) - userId String - userInterests Video[] - languageInterests String[] - countryInterests String[] - createdAt DateTime @default(now()) - updatedAt DateTime @default(now()) @updatedAt + id String @id @default(uuid()) + userId String + userInterests Video[] + languageInterestIds String[] + countryInterestIds String[] + createdAt DateTime @default(now()) + updatedAt DateTime @default(now()) @updatedAt } model ShortLinkDomain { diff --git a/libs/prisma/media/src/__generated__/pothos-types.ts b/libs/prisma/media/src/__generated__/pothos-types.ts index 0567c6769b4..6077993a650 100644 --- a/libs/prisma/media/src/__generated__/pothos-types.ts +++ b/libs/prisma/media/src/__generated__/pothos-types.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -import type { Prisma, CloudflareImage, MuxVideo, MuxSubtitleTrack, CloudflareR2, Video, VideoTitle, VideoVariantDownload, VideoVariant, VideoEdition, VideoSubtitle, VideoSnippet, VideoDescription, VideoImageAlt, VideoStudyQuestion, ImportTimes, BibleCitation, BibleBook, BibleBookName, Keyword, TagName, Tag, Tagging, Taxonomy, TaxonomyName, UserMediaRole, ShortLinkDomain, ShortLink, ShortLinkBlocklistDomain, VideoOrigin, Playlist, PlaylistItem, ArclightApiKey } from ".prisma/api-media-client/index.js"; +import type { Prisma, CloudflareImage, MuxVideo, MuxSubtitleTrack, CloudflareR2, Video, VideoTitle, VideoVariantDownload, VideoVariant, VideoEdition, VideoSubtitle, VideoSnippet, VideoDescription, VideoImageAlt, VideoStudyQuestion, ImportTimes, BibleCitation, BibleBook, BibleBookName, Keyword, TagName, Tag, Tagging, Taxonomy, TaxonomyName, UserMediaRole, UserMediaProfile, ShortLinkDomain, ShortLink, ShortLinkBlocklistDomain, VideoOrigin, Playlist, PlaylistItem, ArclightApiKey } from ".prisma/api-media-client/index.js"; export default interface PrismaTypes { CloudflareImage: { Name: "CloudflareImage"; @@ -116,8 +116,8 @@ export default interface PrismaTypes { Where: Prisma.VideoWhereInput; Create: {}; Update: {}; - RelationName: "title" | "snippet" | "description" | "studyQuestions" | "imageAlt" | "subtitles" | "children" | "parents" | "variants" | "bibleCitation" | "keywords" | "images" | "cloudflareAssets" | "videoEditions" | "origin"; - ListRelations: "title" | "snippet" | "description" | "studyQuestions" | "imageAlt" | "subtitles" | "children" | "parents" | "variants" | "bibleCitation" | "keywords" | "images" | "cloudflareAssets" | "videoEditions"; + RelationName: "title" | "snippet" | "description" | "studyQuestions" | "imageAlt" | "subtitles" | "children" | "parents" | "variants" | "bibleCitation" | "keywords" | "images" | "cloudflareAssets" | "videoEditions" | "origin" | "userMediaProfiles"; + ListRelations: "title" | "snippet" | "description" | "studyQuestions" | "imageAlt" | "subtitles" | "children" | "parents" | "variants" | "bibleCitation" | "keywords" | "images" | "cloudflareAssets" | "videoEditions" | "userMediaProfiles"; Relations: { title: { Shape: VideoTitle[]; @@ -194,6 +194,11 @@ export default interface PrismaTypes { Name: "VideoOrigin"; Nullable: true; }; + userMediaProfiles: { + Shape: UserMediaProfile[]; + Name: "UserMediaProfile"; + Nullable: false; + }; }; }; VideoTitle: { @@ -664,6 +669,26 @@ export default interface PrismaTypes { ListRelations: never; Relations: {}; }; + UserMediaProfile: { + Name: "UserMediaProfile"; + Shape: UserMediaProfile; + Include: Prisma.UserMediaProfileInclude; + Select: Prisma.UserMediaProfileSelect; + OrderBy: Prisma.UserMediaProfileOrderByWithRelationInput; + WhereUnique: Prisma.UserMediaProfileWhereUniqueInput; + Where: Prisma.UserMediaProfileWhereInput; + Create: {}; + Update: {}; + RelationName: "userInterests"; + ListRelations: "userInterests"; + Relations: { + userInterests: { + Shape: Video[]; + Name: "Video"; + Nullable: false; + }; + }; + }; ShortLinkDomain: { Name: "ShortLinkDomain"; Shape: ShortLinkDomain;