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
データベースを参照しているため正しい構成を取得していることをエラー メッセージが示しているように見えますが、ユーザー名とホストが間違っているということです。
ここで何が欠けているのでしょうか?