Postgres Schema default$default



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 prisma.yml.

http://localhost:4466 equals http://localhost:4466/default/default.

So you can enter

endpoint: http://localhost:4466/servicename/stagename

Then Prisma will use the servicename$stagename schema in your database.

(All of this assumes your Prisma server runs at http://localhost:4466).


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?

You can see it here:


Ah sorry I didn’t see that you are connecting to an existing database.

Running prisma introspect should currently connect to the public schema already, is that not the case for you?

See 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 default$default

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 default$default schema:

  - user

and throw an error saying it can’t find default$default.user

I could have done something wrong, so I’ll try it again. I understand it’s an experimental feature :slight_smile:


Oh wait, my bad… I just needed to specify schema: public in my docker-compose. Working now :slight_smile: oops!


Awesome, we should definitely add that information to the docs! I created an issue for this here: :slight_smile:


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: