prisma / prisma1-upgrade

Prisma 1 Upgrade is a CLI tool to help Prisma 1 users upgrade to Prisma 2.x or newer.
https://www.prisma.io/docs/guides/upgrade-from-prisma-1/how-to-upgrade
Apache License 2.0
51 stars 7 forks source link

Error Syntax Error: Expected ":", found "(". #95

Open darkmavis1980 opened 3 years ago

darkmavis1980 commented 3 years ago

When I'm running the npx prisma-upgrade command I'm getting the following error:

Error Syntax Error: Expected ":", found "(".

I've already created the schema.prisma with the npx prisma init, and run the npx prisma introspect, but when I run the npx prisma-upgrade pointing the origina prisma1 yaml configuration, and the newly generated prisma.schema, it just fails with the above error.

Any idea?

shahbaazdev commented 3 years ago

I got same issue if anyone know how to prevent this issue

chancesmith commented 2 years ago

same here

chancesmith commented 2 years ago

Got it working 👏

I believe the old datamodel file needs to be rename and still contain the old Prisma1 schema. So the upgrade CLI can see incompatibilities, the old schema will be compared with the new schema.

Here are the steps I took:

  1. npx introspect will give you a new Prisma2 schema in your schema.prisma file
  2. rename your old datamodel.graphql to datamodel.prisma
  3. update datamodel property of prisma.yml to datamodel: datamodel.prisma
  4. now run npx prisma-upgrade
julianwagle commented 2 years ago

I was experiencing this issue when upgrading from 1 > 4. I did not find a fix, instead I decided to upgrade from 1 > 3 and then 3 > 4. This advice may save you many headaches. Good luck!

janpio commented 2 years ago

Can you share the exact versino of Prisma 3 you were using @julianwagle? It seems this is generally caused by new Prisma schema syntax we introduced along the way, so the safe option might even be to use a Prisma 2.x for the initial update and then go to 3 and 4 - but if you found a working version of 3.x this might indeed work for others as well.