Prisma正在使用docker的数据库设置,并且工作正常。我想使用另一个数据库,例如AWS RDS。 我正在使用此文档:https://www.prisma.io/docs/tutorials/setup-prisma/connect-empty-db/mysql-dusee0nore
您之前有我的文件了
docker-compose.yml(之前)
function names(arr: [string, number]) {
let result: [] = [];
arr.forEach((element) => {
if (typeof(element) === "string") {
result.push(element);
}
})
return result;
}
docker-compose.yml(之后)
names([['Amir', 34], ['Betty', 17]])
Expected: ['Amir', 'Betty'] but got: type error: Argument of type 'string' is not assignable to parameter of type 'never'.
主机,用户和密码字段很好,因为我可以使用其他工具连接到该数据库。
然后:
version: '3'
services:
prisma:
image: prismagraphql/prisma:1.8
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
mysql:
ports:
- '3306:3306'
image: mysql:5.7
restart: always
environment:
MYSQL_ROOT_PASSWORD: prisma
TZ: America/Los_Angeles
volumes:
- mysql:/var/lib/mysql
volumes:
mysql:
启动服务器后,我得到了:
version: '3'
services:
prisma:
image: prismagraphql/prisma:1.8
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: *************.us-west-2.rds.amazonaws.com
user: *************
password: *************
rawAccess: true
port: '3306'
migrations: false
或
> docker-compose up -d
> Recreating server_prisma_1 ... done
有什么主意我该如何调试?