This commit is contained in:
robin
2022-05-21 06:48:12 +08:00
parent b5f918776e
commit 96333ae7a9
45 changed files with 650 additions and 64 deletions
+23 -3
View File
@@ -1,6 +1,6 @@
/*数据库配置*/
module.exports = {
mysql: {
mysql : {
database: "bamboo",
username: "bamboo",
password: "bamboo",
@@ -46,11 +46,31 @@ module.exports = {
},
},
},
redis:{},
sqlite:{
redis : {},
sqlite: {
dialect: 'sqlite',
storage: 'app/sqlite/database.sqlite',
logging: false,
// model的全局配置
define : {
// 添加create,update,delete时间戳
timestamps: true,
// 添加软删除
paranoid: false,
// 防止修改表名为复数
freezeTableName: true,
// 防止驼峰式字段被默认转为下划线
underscored: false,
},
dialectOptions: {
typeCast(field, next) {// 让读取date类型数据时返回字符串而不是UTC时间
if (field.type === 'DATETIME') {
// console.log(field);
return field.string();
}
return next();
},
},
},