From 714f947b8630c23336517a383c4889867372756d Mon Sep 17 00:00:00 2001 From: ZhuiGuangAI Dev Date: Sat, 30 May 2026 21:53:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=A7=8D=E5=AD=90=E8=84=9A?= =?UTF-8?q?=E6=9C=AC=EF=BC=9A=E6=9B=B4=E6=96=B0=E5=B7=B2=E6=9C=89=E6=9D=BF?= =?UTF-8?q?=E5=9D=97=E7=9A=84=E5=90=8D=E7=A7=B0/=E6=8F=8F=E8=BF=B0/?= =?UTF-8?q?=E5=9B=BE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/seed-bot-forum.mjs | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/scripts/seed-bot-forum.mjs b/scripts/seed-bot-forum.mjs index 405922e..34e53dc 100644 --- a/scripts/seed-bot-forum.mjs +++ b/scripts/seed-bot-forum.mjs @@ -162,19 +162,32 @@ async function createIndustryCategories() { }); console.log(` + ${cat.name}`); } else { - if (!childCat.parentId) { - await prisma.forumCategory.update({ - where: { id: childCat.id }, - data: { parentId: parent.id }, - }); - } - console.log(` ✓ ${cat.name} (exists)`); + await prisma.forumCategory.update({ + where: { id: childCat.id }, + data: { + name: cat.name, + icon: cat.icon, + description: cat.description, + sortOrder: cat.sortOrder, + parentId: parent.id, + }, + }); + console.log(` ↻ ${cat.name} (updated)`); } const existingSlugs = new Set(childCat.children.map(c => c.slug)); for (const sub of cat.children) { if (existingSlugs.has(sub.slug)) { - console.log(` - ${sub.name} (exists)`); + await prisma.forumCategory.update({ + where: { slug: sub.slug }, + data: { + name: sub.name, + icon: sub.icon, + description: sub.description, + parentId: childCat.id, + }, + }); + console.log(` ↻ ${sub.name} (updated)`); } else { const conflictSlug = await prisma.forumCategory.findUnique({ where: { slug: sub.slug },