up
This commit is contained in:
@@ -1 +1,57 @@
|
||||
/*数据库配置*/
|
||||
module.exports = {
|
||||
mysql: {
|
||||
database: "bamboo",
|
||||
username: "bamboo",
|
||||
password: "bamboo",
|
||||
options : {
|
||||
dialect: 'mysql',
|
||||
host : "192.168.1.26",
|
||||
port : 3306,
|
||||
// 禁用日志记录或提供自定义日志记录功能;默认值: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();
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
redis:{},
|
||||
sqlite:{
|
||||
dialect: 'sqlite',
|
||||
storage: 'app/sqlite/database.sqlite',
|
||||
logging: false,
|
||||
},
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
/*redis配置*/
|
||||
module.exports = {
|
||||
port: 3000,
|
||||
}
|
||||
Reference in New Issue
Block a user