import { PrismaClient } from "@prisma/client"; import { frames, forks, shocks, tires } from "../src/lib/catalog"; const prisma = new PrismaClient(); async function main() { const products = [...frames, ...forks, ...shocks, ...tires]; for (const product of products) { const { id, category, brand, model, imagePath, sources } = product; const position = "position" in product ? product.position : null; await prisma.product.upsert({ where: { id }, update: { category, position, brand, model, imagePath, specs: JSON.stringify(product), setup: JSON.stringify(product), sources: JSON.stringify(sources) }, create: { id, category, position, brand, model, imagePath, specs: JSON.stringify(product), setup: JSON.stringify(product), sources: JSON.stringify(sources) }, }); } await prisma.riderPreference.upsert({ where: { id: "default" }, update: {}, create: { id: "default" }, }); } main().finally(async () => prisma.$disconnect());