我一直在研究Prisma项目,直到我知道它通过docker支持mysql,现在将它添加到我的项目中很有趣。尽管所有当前可用的教程仅显示了如何从头开始为一个新项目。
有关添加mysql数据库的代码,请参见下文。
当我用yarn start和pyramida部署运行代码时,所有普通模式和查询都将加载到Playground中。但是,当我运行docker-compose up -d和pyramida部署时,操场会从生成的不正确的pyramida.graphql中加载所有查询,变异等。换句话说,我真的不知道为什么添加docker会导致此问题。我以为docker文件将只运行与yarn start相同的文件?任何帮助将非常感激。我
docker-compose.yml:
version: '3'
services:
prisma:
image: prismagraphql/prisma:1.17
restart: always
ports:
- "4466:4466"
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: my-secret
databases:
default:
connector: mysql
host: mysql
port: 3306
user: root
password: prisma
migrations: true
rawAccess: true
mysql:
image: mysql:5.7
restart: always
environment:
MYSQL_ROOT_PASSWORD: prisma
volumes:
- mysql:/var/lib/mysql
volumes:
mysql:
prisma.yml:
endpoint: http://localhost:4466
datamodel: datamodel.graphql
seed:
import: seed.graphql
hooks:
post-deploy:
- graphql get-schema --project database
graphqlconfig.yml:
projects:
app:
schemaPath: src/schema.graphql
extensions:
endpoints:
default: http://localhost:4000
database:
schemaPath: src/generated/prisma.graphql
extensions:
prisma: database/prisma.yml