npx prisma db push error after migrating from Planetscale to Neon
Hello guys! I've recently migrated my database from Planetscale to Neon, the migration was successful, and everything is okay. But once I tried to run
npx prisma db push, I got the following output with warnings and this error, even If I change nothing in the schema:
PS: This happened only after I did the migration.
What should I do? Any hints please guys? Your help is much appreciated, and have a great day everyone!
10 Replies
spiritual-aqua•2y ago
How did you perform the initial migration that was successful?
My guess is that some of the migrations your trying to push have invalid syntax, since they were originally generated for MySQL. You’ll probably need to alter them slightly to work around this error.
curious-tealOP•2y ago
Hi Evan, thank you for your reply.
I used the pgloader docker image with this config, as shown in the screenshot:
And yeah the error indicates that the primary key needs to be changed, but it fails during the multiple Renaming

curious-tealOP•2y ago
My Prisma schema is as follows, where I was using
@default(uuid()) for each model Id which is of type String in Planetscale, so I think that this may be causing the issue?!
spiritual-aqua•2y ago
I'm not a Prisma expert, but do you need to perform
prisma db pull against Postgres to update the models?curious-tealOP•2y ago
Thank youu so much, Evan for your suggestions you're a life savior! 😅
curious-tealOP•2y ago
Performing the
prisma db pull magically resolved this issue. It completely rewrites my Prisma schema file with relations from the previous data model as follows:
curious-tealOP•2y ago
And here's the output of the pull command:

spiritual-aqua•2y ago
Wait, so this is good or bad? 😄
curious-tealOP•2y ago
Huh, good, at least as I think! 😅 Prisma basically added maps to the correct relations from the previous data model. And this fixed the error when I do push.
spiritual-aqua•2y ago
Fantastic!