PrismaP
Prisma2y ago
6 replies
Anas Badran

Unable to run the seed script successfully

The seed script
import { db } from '@/app/lib/database';
import * as data from '@/app/lib/placeholder-data';

async function main() {
  for (const c of data.customers) {
    await db.customer.create({ data: c });
  }
  for (const i of data.invoices) {
    await db.invoice.create({ data: i });
  }
  for (const r of data.revenue) {
    await db.revenue.create({ data: r });
  }
  for (const u of data.users) {
    await db.user.create({ data: u });
  }
}
main();
console.log('the database has seeded successfully');

the
package.json
seed script

"seed": "ts-node prisma/seed.ts"
Was this page helpful?