Prisma1: How to set database in prisma mysql?

Created on 6 Dec 2018  路  3Comments  路  Source: prisma/prisma1

Hi. I am new to Prisma and today I've got to access mysql with graphql with prisma.

I want to set my database for prisma manually but database attribute doesn't seem to work.
I've set my prisma env like below

    environment:
      PRISMA_CONFIG: |
        port: 4466
        # uncomment the next line and provide the env var PRISMA_MANAGEMENT_API_SECRET=my-secret to activate cluster security
        # managementApiSecret: secret
        databases:
          default:
            database: talktalk
            connector: mysql

However when I tried the insert, the table mutates in default@default database instead of my talktalk database.
Alt desc

How can I change the database name that is used in prisma docker-compose?

Most helpful comment

Ok so it is better not to change the database name currently. Thanks for the confirm.

All 3 comments

Hi,

We use default@default naming schema as to support multiple services and stages. This allows us to share the database with multiple services and stages. The stage and scheme are defined in your endpoint, for example, http://localhost:4666/service/stage. If there is nothing it fallbacks to default@default.

The data do indeed getting into talktalk DB but we create those special names to support multiple services.

Ok so it is better not to change the database name currently. Thanks for the confirm.

Maybe the behavior change since this issue, but FYI, you can know change the database name:

  prisma:
    image: prismagraphql/prisma:1.34
    restart: unless-stopped
    depends_on:
      - mysql
    environment:
      PRISMA_CONFIG: |
        port: 4466
        databases:
          default:
            database: custom_name
            connector: mysql
            host: mysql
            port: 3306
            user: root
            password: prisma
Was this page helpful?
0 / 5 - 0 ratings

Related issues

hoodsy picture hoodsy  路  3Comments

jannone picture jannone  路  3Comments

dohomi picture dohomi  路  3Comments

sorenbs picture sorenbs  路  3Comments

MitkoTschimev picture MitkoTschimev  路  3Comments