diff --git a/backend/prisma/seed.ts b/backend/prisma/seed.ts index b04eb7f..80c465e 100644 --- a/backend/prisma/seed.ts +++ b/backend/prisma/seed.ts @@ -2,30 +2,80 @@ import { PrismaClient, Prisma } from '@prisma/client'; const prisma = new PrismaClient(); -const teamData: Prisma.TeamCreateInput[] = [ +const teams: Prisma.TeamCreateInput[] = [ { id: '1', name: '001', + pairs: { + create: [ + { + id: '1', + name: 'a', + }, + { + id: '2', + name: 'b', + }, + ], + }, }, { id: '2', name: '002', + pairs: { + create: [ + { + id: '3', + name: 'a', + }, + { + id: '4', + name: 'b', + }, + ], + }, }, { id: '3', name: '003', + pairs: { + create: [ + { + id: '5', + name: 'a', + }, + { + id: '6', + name: 'b', + }, + ], + }, }, { id: '4', name: '004', + pairs: { + create: [ + { + id: '7', + name: 'a', + }, + { + id: '8', + name: 'b', + }, + ], + }, }, ]; async function main() { console.log(`Start seeding ...`); - for (const u of teamData) { - const team = await prisma.team.create({ - data: u, + for (const u of teams) { + const team = await prisma.team.upsert({ + where: { id: u.id }, + update: {}, + create: u, }); console.log(`Created user with id: ${team.id}`); }