我正在努力在 Shippable 上建立一个 CI 环境。我现在有一个测试数据库,我需要针对它运行我的迁移,但是我收到一个对我来说没有意义的错误
正在执行的构建步骤是这样的:
(cd www && NODE_ENV=test knex --knexfile ./config/knexplus.js migrate:latest)
输出是这样的:
Working directory changed to ~/src/github.com/org/api/www/config
Using environment: test
Knex:warning - Pool2 - Error: Pool was destroyed
Knex:Error Pool2 - Error: ER_DBACCESS_DENIED_ERROR: Access denied for user ''@'localhost' to database 'my_test'
Knex:Error Pool2 - Error: ER_DBACCESS_DENIED_ERROR: Access denied for user ''@'localhost' to database 'my_test'
Error: Pool was destroyed
不要误会我的意思,我理解这个信息,但不是我为什么收到它。在运行迁移之前,我有构建转储knexplus.js
文件内容:
(cd www && cat ./config/knexplus.js)
'use strict';
exports.vagrant = exports.staging = exports.production = {
client: 'mysql',
connection: {
host: '127.0.0.1',
port: '3306',
user: 'shippable',
password: '',
database: 'mine',
timezone: 'UTC',
charset: 'utf8',
debug: false
},
migrations: {
tableName: '_migrations',
directory: '../db/migrations'
},
seeds: {
directory: '../db/seeds'
}
};
exports.test = {
client: 'mysql',
connection: {
host: '127.0.0.1',
port: '3306',
user: 'shippable',
password: '',
database: 'my_test',
timezone: 'UTC',
charset: 'utf8',
debug: false
},
migrations: {
tableName: '_migrations',
directory: '../db/migrations'
},
seeds: {
directory: '../db/seeds'
}
};
我注意到错误消息似乎表明我们正在获取正确的配置,因为它引用了my_test
数据库,但是用户名和主机错误。
知道我在这里可能缺少什么吗?