PrismaP
Prisma15mo ago
1 reply
Anh Nguyen

Fail first deployment with typesafe raw query

The prisma generate --sql needs the queried tables/models to exist in the database. So if it's the first time you deploy, this build command will fail.

prisma generate --sql --no-engine && prisma migrate deploy && next build

But without --sql it will also fail.

So first you'll have to remove the --sql and deploy. It will fail, but at least it generates the db structure. Then you'll have to add --sql back and deploy again. Then it will be ok.

I've learned this the hard way. So the question is how to deploy the first time without failure?
Was this page helpful?