import { closeDb, getDb } from "@/db/client"; import { templates } from "@/db/schema"; import { builtInTemplates } from "@/lib/templates"; const db = getDb(); for (const template of builtInTemplates) { await db .insert(templates) .values({ slug: template.slug, name: template.name, description: template.description, category: template.category, structure: template as unknown as Record, builtIn: true, }) .onConflictDoUpdate({ target: templates.slug, set: { name: template.name, description: template.description, category: template.category, structure: template as unknown as Record, builtIn: true, updatedAt: new Date(), }, }); } await closeDb();