prisma1-upgrade icon indicating copy to clipboard operation
prisma1-upgrade copied to clipboard

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

Open darkmavis1980 opened this issue 4 years ago • 5 comments

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?

darkmavis1980 avatar Jan 05 '21 14:01 darkmavis1980

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

shahbaazdev avatar Jul 23 '21 07:07 shahbaazdev

same here

chancesmith avatar Jun 21 '22 21:06 chancesmith

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

chancesmith avatar Jun 22 '22 13:06 chancesmith

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!

julianwagle avatar Sep 19 '22 16:09 julianwagle

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.

janpio avatar Sep 19 '22 16:09 janpio