diff --git a/prisma/seed.ts b/prisma/seed.ts new file mode 100644 index 0000000..bdcfdf6 --- /dev/null +++ b/prisma/seed.ts @@ -0,0 +1,34 @@ +import { PrismaClient } from '@prisma/client'; + +const prisma = new PrismaClient(); + +async function main() { + await prisma.role.create({ + data: { + name: 'user', + }, + }); + await prisma.role.create({ + data: { + name: 'admin', + }, + }); + + await prisma.promoCode.create({ + data: { + name: 'PROMO1000', + value: 1000, + }, + }); +} + +main() + .then(async () => { + await prisma.$disconnect(); + }) + .catch(async (e) => { + console.error(e); + await prisma.$disconnect(); + process.exit(1); + }); +