This repository has been archived by the owner on Sep 2, 2022. It is now read-only.
Prisma doesn't execute mutations on tables in public
schema of existing PostgreSQL database
#2846
Labels
bug/1-repro-available
A reproduction exists and needs to be confirmed.
Describe the bug
A clear and concise description of what the bug is.
When
schema: public
option is provided in docker-compose.yml, Prisma successfully executes queries on tables inpublic
schema of existing PostgreSQL database. But during mutations, Prisma looks for the table indefault$default
schema and then PostgreSQL throws the following error since the table exists inpublic
schema and notdefault$default
schema.To Reproduce
Steps to reproduce the behavior:
prisma init
Selecting existing PostgreSQL database during
prisma init
creates prisma.yml, datamodel.graphql and docker-compose.yml.prisma.yml:
datamodel.graphql:
docker-compose.yml:
docker-compose up
(-d
option omitted to view logs)In another terminal,
prisma deploy
Executing this query in graphql playground (localhost:4466)
gives this result:
which is expected and matches the result from psql:
This shows that prisma is able to read from the
public
schema of PostgreSQL.Executing the create mutation
results in this error in graphql playground:
and a corresponding error from PostgreSQL in docker-compose up:
This error is thrown during update and delete mutations too.
It seems that prisma looks for the table in
default$default
schema during mutations andpublic
schema during queries.Expected behavior
A clear and concise description of what you expected to happen.
Mutations should be executed on a given table in
public
schema instead ofdefault$default
schema whenschema: public
option is provided in docker-compose.yml.Screenshots
If applicable, add screenshots to help explain your problem.
Versions (please complete the following information):
Ubuntu 18.04 LTS
prisma/1.14.0-Beta (linux-x64) node-v8.11.3
docker-compose version 1.22.0, build f46880fe
Additional context
Add any other context about the problem here.
default$default
schema from docker-compose up:The create mutation works if a new
manager_keyword
table is created indefault$default
schema. But this is not helpful since queries are executed on a table inpublic
schema and mutations are executed on a different table indefault$default
schemaIf
schema: public
option is not provided in docker-compose.yml, then all queries and mutations work as expected indefault$default
schema.The text was updated successfully, but these errors were encountered: