davidmfoley
davidmfoley
Explore posts from servers
PPrisma
Created by davidmfoley on 4/10/2025 in #help-and-questions
Specifying postgres schema while using a postgres database url
We use prisma migrations with an application that uses kysely, and some direct postgres queries. The application stores its data in a named postgres schema. Our application initializes our postgres pool with a database url, stored in an env var. However, it seems that in order to use prisma with a postgres schema we must append ?schema={name} to the url that is used by prisma to get prisma to understand that it ought to operate in a schema. Additionally, it doesn't seem like there is a way to template that url in the prisma configuration. So we end up needing to use a separate database url env var for prisma, or wrap all prisma invocations in a script that derives the prisma version of the url with the ?schema suffix, from the clean/normal postgres-compatible url. I'm thinking there must be a better way to do this; what am I missing here?
5 replies