Why does Prisma use default database. Is this by d...
# orm-help
j
Why does Prisma use default database. Is this by design?
h
Yes, so that we can support multiple services in the same server. Each service is mapped to
service$stage
. This is controlled by the last two routes of the url. So if your endpoint is https://example.com/backend/dev It will map to
backend$dev
schema in postgres and
backend@dev
in MySQL. If you don't provide any service and stage name, it default name is
default$default
j
šŸ‘šŸ¼
@Ryan Rickerts see this for default;default?
r
Yes, but even when I set it up and let it create a database called
default@default
in MySQL and completely started over so everything matched this convention, I am still getting the same error when I go to load the admin endpoint. So I’m looking at my endpoint in
src/prisma/prisma.service.ts
thinking that is the problem. Everything else is working, but the error I get is the same: ā€œNo service with name ā€˜default’ and stage ā€˜default’ foundā€ even though I haven’t changed anything from the default. @Harshit where do you provide the service and stage name?
This stuff is very confusing. I have different database names and stages, but I’m still getting this
default
service everywhere:
Copy code
$ prisma reset
? Are you sure that you want to reset the data of default in stage default? y/N y
Resetting default@default 345ms

$ prisma deploy
Deploying service `default` to stage `default` to server `local` 1.0s
Service is already up to date.
I got it. It is parsed from the endpoint in prisma.yml
Copy code
nestjs-prisma$ cat prisma.yml
endpoint: <http://localhost:4466/projectName/dev>

datamodel: datamodel.prisma
so my service is now
projectName
and stage is
dev
and the MySQL database is called
proteus@dev
šŸ‘ 1