egg
egg copied to clipboard
由于sequelzie时区问题导致egg-scripts启动报错
sequelize配置如下
config.sequelize = {
datasources: [
{
delegate: 'XXX',
baseDir: 'model/XXX',
dialect: 'mysql',
host: 'XXX',
port: 3306,
database: 'XXX',
username: 'XXX',
password: 'XXX',
timezone: '+8:00',
pool: {
max: 3,
min: 0,
idle: 60000,
acquire: 60000,
},
}
]
}
启动脚本配置如下
"scripts": {
"start": "egg-scripts start --port=7008 --env=prod --workers=3 --daemon --title=XXX",
"start-test": "egg-scripts start --port=7008 --env=test --workers=3 --daemon --title=XXX",
"stop": "egg-scripts stop --title=XXX",
"dev": "egg-bin dev --port=7008",
"debug": "egg-bin debug",
"test-local": "egg-bin test --port=7008",
"test": "npm run lint -- --fix && npm run test-local",
"cov": "egg-bin cov",
"tsc": "ets && tsc -p tsconfig.json",
"ci": "npm run lint && npm run cov && npm run tsc",
"autod": "autod",
"lint": "tslint --project . -c tslint.json",
"clean": "ets clean"
}
执行步骤如下: npm run clean npm run tsc npm run start-test 启动报错 查看日志:
Ignoring invalid timezone passed to Connection: +8:00. This is currently a warning, but in future versions of MySQL2, an error will be thrown if you pass an invalid configuration option to a Connection
+08:00 instead of +8:00
非常感谢,已解决