I am using Prisma with nestjs and having a problem...
# orm-help
s
I am using Prisma with nestjs and having a problem seeding to PostgreSQL DB, when I run seed command I get that the seed is done but the db isn't affected, nothing else is logged out
r
What’s present in your seed script?
s
this and seems like it's not executed at all
Copy code
import { PrismaClient, Prisma } from '@prisma/client';

const prisma = new PrismaClient();

const userData: Prisma.UserCreateInput[] = [
  {
    name: 'Alice',
    email: '<mailto:alice@prisma.com|alice@prisma.com>',
  },
  {
    name: 'Nilu',
    email: '<mailto:nilu@prisma.com|nilu@prisma.com>',
  },
  {
    name: 'Mahmoud',
    email: '<mailto:mahmoud@prisma.com|mahmoud@prisma.com>',
  },
];

async function main() {
  console.log(`Start seeding ...`);
  for (const u of userData) {
    const user = await prisma.user.create({
      data: u,
    });
    console.log(`Created user with id: ${user.id}`);
  }
  console.log(`Seeding finished.`);
  console.log(await prisma.user.findMany({}));
}

main()
  .catch((e) => {
    console.error(e);
    process.exit(1);
  })
  .finally(async () => {
    await prisma.$disconnect();
  });
r
What’s the name of the file and how are you running it?
s
seed.ts and im running it using
Copy code
yarn prisma db seed --preview-feature
r
@janpio any idea here? The script sees fine though.
j
This looks like Windows, and the current version of seeding has never worked on Windows - there is an issue about that.
There is a new version of
db seed
ready to test though, @Joël can provide a link to the issue.
That one should work find on Windows as well.
s
Thanks @janpio
j
🙌 2