import prisma from './lib/prisma';

async function main() {
  const roles = await prisma.role.findMany();
  for (const r of roles) {
    if (!r.permissions.includes('DATA_DELETE')) {
      await prisma.role.update({
        where: { id: r.id },
        data: { permissions: [...r.permissions, 'DATA_DELETE'] }
      });
      console.log('Added DATA_DELETE to: ' + r.name);
    } else {
      console.log('Already has DATA_DELETE: ' + r.name);
    }
  }
  await prisma.$disconnect();
}

main();
