baptisteArno / prisma-database-sync

A typesafe databases sync tool powered by prisma
42 stars 2 forks source link

Cannot read properties of undefined (reading 'length') #1

Open marc-on-github opened 5 months ago

marc-on-github commented 5 months ago

Thank you very much for this project! I just wanted to test it, but can't get it to work, do you have any ideas?

$ pnpm generate

> prisma-database-sync@1.0.0 generate /Users/marc/Dev/clone/prisma-database-sync
> prisma generate --schema src/schemas/source.prisma && prisma generate --schema src/schemas/target.prisma

Environment variables loaded from .env
Prisma schema loaded from src/schemas/source.prisma
Error: 
✔ Generated Prisma Client (v5.11.0) to ./src/prisma-clients/source in 305ms

Cannot read properties of undefined (reading 'length')

 ELIFECYCLE  Command failed with exit code 1.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
marc-on-github commented 5 months ago

Changed this: From: const groupedUniqueFields = model.uniqueFields.shift();

To: const groupedUniqueFields = model.uniqueFields && model.uniqueFields.length > 0 ? model.uniqueFields.shift() : [];

Thivieira commented 1 month ago

Hello i had to use @marc-on-github solution still. Can you reopen this issue?

`> prisma-database-sync@1.0.0 postinstall /home/thivieira/dev/prisma-database-sync

pnpm generate

prisma-database-sync@1.0.0 generate /home/thivieira/dev/prisma-database-sync prisma generate --schema src/schemas/source.prisma && prisma generate --schema src/schemas/target.prisma

Environment variables loaded from .env Prisma schema loaded from src/schemas/source.prisma Error: ✔ Generated Prisma Client (4.16.2 | library) to ./src/prisma-clients/source in 1.18s

Cannot read properties of undefined (reading 'length')

 ELIFECYCLE  Command failed with exit code 1.  ELIFECYCLE  Command failed with exit code 1.`    Thanks for this repo 😊