Skip to content

[Feature Request] Add support for different connection string than .env file #650

@puchm

Description

@puchm
  1. Prisma version (prisma -v or npx prisma -v):
    Prisma Studio 0.359.0
    Prisma 2.20.1
  2. Logs from Developer Tools Console or Command line, if any:
Message: Error in Prisma Client request: 

Error: Can't reach database server at `db`:`5432`

Please make sure your database server is running at `db`:`5432`.
    at cb (C:\Users\Moritz\AppData\Roaming\@prisma\studio-electron\projects\7a225383\runtime\index.js:34780:17)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async C:\Users\Moritz\AppData\Local\Programs\@prismastudio-electron\resources\app.asar\node_modules\@prisma\studio-pcw\build\pcw.js:133:35
    at async C:\Users\Moritz\AppData\Local\Programs\@prismastudio-electron\resources\app.asar\node_modules\@prisma\studio-pcw\build\pcw.js:106:32
    at async PCW.request (C:\Users\Moritz\AppData\Local\Programs\@prismastudio-electron\resources\app.asar\node_modules\@prisma\studio-pcw\build\pcw.js:173:46)
    at async IpcMainImpl.prisma (C:\Users\Moritz\AppData\Local\Programs\@prismastudio-electron\resources\app.asar\build\ipc\prisma-ipc.js:72:34)

Query:
prisma.user.findMany({
  take: 100,
  skip: 0,
  select: {
    id: true,
    email: true,
    userName: true,
    fullName: true,
    password: true,
  }
})

Feature Request

I would like to have the possibility to specify a different hostname than what Prisma loads from my .env file.
Since I am running Prisma Migrate, my development database and everything else in Docker containers the IP is the name of the docker container, e.g. db:5432. Prisma Studio is the only thing not running in Docker containers and needs to use a different IP to access the database from outside, e.g. localhost:5432.

Please add the possibility to use a different hostname for Studio than for the other stuff. I think this could be accomplished using either

  • a hostname field when opening a schema in Prisma Studio
  • a second url parameter in the schema file inside the datasource block, e.g. studioUrl

At the moment I am solving this by supplying a different .env file to the containers but I would like to use the same for both.

Thanks for your great work with Prisma, I love it.
-Moritz

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions