Mathis 2fdc16e003
Add initial seeding script for roles and promo codes
This commit introduces a new seed script located at prisma/seed.ts. The script seeds the database with default roles ('user' and 'admin') and a sample promo code ('PROMO1000' with a value of 1000). This setup helps initialize essential data for application functionality.
2024-11-12 13:30:21 +01:00

35 lines
536 B
TypeScript

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);
});