import { PrismaClient } from '@prisma/client'; const prisma = new PrismaClient(); async function main() { try { // Array of sources to create/update const sourcesToUpsert = [ { name: 'Vero', url: 'https://pricelist.vero.com.mk/89_2.html', logo: 'vero-logo.png', }, { name: 'dim', url: 'https://dim.marketceni.mk/', logo: 'tinex-logo.png', }, // Add more sources as needed ]; // Upsert all sources const upsertedSources = await Promise.all( sourcesToUpsert.map((source) => prisma.source.upsert({ where: { name: source.name }, update: { url: source.url, logo: source.logo, }, create: source, }), ), ); console.log('Upserted sources:', upsertedSources); } catch (error) { console.error('Error:', error); } finally { await prisma.$disconnect(); } } main();