How do I specify which schema Prisma should generate tables under? I can see it defaults to default$default right now
You do that using the
endpoint property in
So you can enter
Then Prisma will use the
servicename$stagename schema in your database.
(All of this assumes your Prisma server runs at
Can I specify Prisma to use the “public” schema in Postgres? I’m connecting to an existing Postgres database that doesn’t put tables under a schema
The configuration for the Postgres connector provides a “database” key, is that the one you refer you?
Ah sorry I didn’t see that you are connecting to an existing database.
prisma introspect should currently connect to the
public schema already, is that not the case for you?
See https://github.com/prismagraphql/prisma/issues/2256 for more context.
Yeah when I ran
prisma introspect it generated the schema correctly but when I went to deploy it, it would still look at
So for example, the existing database looks like this…
prisma (this is the postgres database) - user (existing table created in the database)
when I try to deploy, it’ll create the
prisma - user default$default
and throw an error saying it can’t find
I could have done something wrong, so I’ll try it again. I understand it’s an experimental feature
Oh wait, my bad… I just needed to specify
schema: public in my docker-compose. Working now oops!
Awesome, we should definitely add that information to the docs! I created an issue for this here: https://github.com/prismagraphql/prisma/issues/2631
Hm, so I’m able to query for
users and it will correctly return all the users in the database but when i query for an individual
user, it returns null…
I have the same problem, but even after specifying
schema: public in docker-compose.yml, prisma will still use default$default schema.
This seems related: https://github.com/prismagraphql/prisma/issues/2846.