1.0.5 • Published 4 years ago
egg-yhsd-sequelize v1.0.5
安装依赖包:
npm i egg-yhsd-sequelize
# 根据数据库类型,选择安装下方的依赖
npm install --save pg pg-hstore # Postgres
npm install --save mysql2
npm install --save mariadb
npm install --save sqlite3
npm install --save tedious # Microsoft SQL Server
启用
// {app_root}/config/plugin.js
exports.tsSequelize = {
enable: true,
package: 'egg-yhsd-sequelize',
};
默认配置
export default {
host: '127.0.0.1',
port: 3306,
username: 'root',
password: '',
dialect: 'mysql',
define: {
freezeTableName: true,
underscored: true,
},
query: { raw: true },
timezone: '+08:00',
isAutoSync: false,
isForceSync: false,
benchmark: true,
logging(...args) {
const used = typeof args[1] === 'number' ? `(${args[1]}ms)` : '';
app.logger.info('[sequelize]%s %s', used, args[0]);
},
};