Handle duplicated studios

This commit is contained in:
Zoe Roux
2025-12-06 00:47:45 +01:00
parent 79075e497d
commit 10ac7e1ec6
2 changed files with 3 additions and 1 deletions
@@ -4,6 +4,7 @@ import { showStudioJoin, studios, studioTranslations } from "~/db/schema";
import { conflictUpdateAllExcept, sqlarr, unnestValues } from "~/db/utils";
import type { SeedStudio } from "~/models/studio";
import { record } from "~/otel";
import { uniqBy } from "~/utils";
import { enqueueOptImage, flushImageQueue, type ImageTask } from "../images";
type StudioI = typeof studios.$inferInsert;
@@ -15,6 +16,7 @@ export const insertStudios = record(
if (!seed?.length) return [];
return await db.transaction(async (tx) => {
seed = uniqBy(seed!, (x) => x.slug);
const vals: StudioI[] = seed.map((x) => {
const { translations, ...item } = x;
return item;