import { PrismaClient } from '@prisma/client' const prisma = new PrismaClient() async function main() { const toys = await prisma.category.upsert({ where: { slug: 'igrushki' }, update: {}, create: { name: 'Игрушки', slug: 'igrushki', sort: 1 }, }) const gifts = await prisma.category.upsert({ where: { slug: 'suveniry' }, update: {}, create: { name: 'Сувениры', slug: 'suveniry', sort: 2 }, }) await prisma.product.upsert({ where: { slug: 'myagkaya-sova' }, update: {}, create: { title: 'Мягкая сова', slug: 'myagkaya-sova', description: 'Ручная работа, хлопок и синтепон.', priceCents: 189000, imageUrl: 'https://images.unsplash.com/photo-1558618666-fcd25c85cd64?w=600&q=80', published: true, categoryId: toys.id, }, }) await prisma.product.upsert({ where: { slug: 'suvenir-kolokolchik' }, update: {}, create: { title: 'Колокольчик керамический', slug: 'suvenir-kolokolchik', description: 'Глазурь, ручная роспись.', priceCents: 45000, imageUrl: 'https://images.unsplash.com/photo-1513519245088-0e12902e5a38?w=600&q=80', published: true, categoryId: gifts.id, }, }) console.log('Seed готов:', { toys: toys.slug, gifts: gifts.slug }) } main() .catch((e) => { console.error(e) process.exit(1) }) .finally(async () => { await prisma.$disconnect() })