module.exports = { database: "bamboo", username: "root", password: "123456", options: { dialect: 'mysql', host: "127.0.0.1", port: 3357, // 禁用日志记录或提供自定义日志记录功能;默认值:console.log // logging: false, // model的全局配置 define: { // 添加create,update,delete时间戳 timestamps: true, // 添加软删除 paranoid: false, // 防止修改表名为复数 freezeTableName: true, // 防止驼峰式字段被默认转为下划线 underscored: false, }, // 由于orm用的UTC时间,这里必须加上东八区,否则取出来的时间相差8小时 timezone: '+08:00', // 连接数 = ((核心数 * 2) + 有效磁盘数) pool: {// 连接池 max: require('os').cpus().length * 2 + 1, min: 0, acquire: 60000, idle: 100000, }, dialectOptions: { charset: "utf8mb4", // collate: "utf8mb4_general_ci", supportBigNumbers: true, bigNumberStrings: true, dateStrings: true, typeCast(field, next) {// 让读取date类型数据时返回字符串而不是UTC时间 if (field.type === 'DATETIME') { // console.log(field); return field.string(); } return next(); }, }, }, path:"app/*/model/*.js", sqlite:{ host: 'localhost', dialect: 'sqlite', pool: { max: 5, min: 0, acquire: 30000, idle: 10000 }, storage: './database.sqlite', operatorsAliases: false } }