why does prisma require `db` to be provided in `prisma.schema` if I'm also giving it `directUrl`?
what it says on the tin - I would expect that directUrl would be preferred for e.g. database migrations, and I don't understand why prisma doesn't allow me to only specify the
directUrl, since I htink that would be much safer...2 Replies
You decided to hold for human wisdom. We'll chime in soon! Meanwhile,
#ask-ai is there if you need a quick second opinion.Prisma requires the url field to be provided in the datasource block of your
schema.prisma file, even if you also specify a directUrl. The url is the primary connection string used by Prisma Client for all runtime queries.
directUrl is optional field that is only used by certain CLI commands (like migrations or introspection) when a direct, non-pooled connection is needed like when using Prisma Accelerate.
The directUrl is not a replacement for url, it is a supplement. Prisma CLI commands that require a direct connection will use directUrl if it is provided, but the application and Prisma Client always require a valid url to function.