
import { PrismaClient } from '@prisma/client';
import games from './games';
import roles from './roles';

const prisma = new PrismaClient();

async function main() {
  await prisma.game.createMany({
    data: games.map((game) => ({
      unified_editionid: game.value,
      name: game.label,
      creator: 'clzhu',
    })),
    skipDuplicates: true,
  });
  await prisma.role.createMany({ data: roles });
}

main()
  .catch((e) => {
    console.log(e);
    process.exit(1);
  })
  .finally(async () => {
    await prisma.$disconnect();
  });
