24 lines
529 B
TypeScript
24 lines
529 B
TypeScript
import { PrismaClient } from '@prisma/client';
|
|
import tenant from './tenant';
|
|
// initialize the Prisma Client
|
|
const prisma = new PrismaClient();
|
|
|
|
async function main() {
|
|
// create two dummy articles
|
|
return prisma.$transaction(async (tx: PrismaClient) => {
|
|
console.log('Seeding...');
|
|
await tenant(tx);
|
|
});
|
|
}
|
|
|
|
// execute the main function
|
|
main()
|
|
.catch((e) => {
|
|
console.error(e);
|
|
process.exit(1);
|
|
})
|
|
.finally(async () => {
|
|
// close the Prisma Client at the end
|
|
await prisma.$disconnect();
|
|
});
|