This commit is contained in:
张成
2026-04-01 13:55:48 +08:00
parent a934d5b239
commit f810f60e3f
2 changed files with 7 additions and 0 deletions

View File

@@ -30,6 +30,12 @@ module.exports = (db) => {
type: Sequelize.JSON,
allowNull: true,
},
// 表字段存在且非空无默认时,须由模型声明,否则 insert 缺列报错
created_at: {
type: Sequelize.DATE,
allowNull: false,
defaultValue: Sequelize.NOW,
},
},
{
tableName: "biz_audit_log",

View File

@@ -13,6 +13,7 @@ async function logAudit(p) {
resource_type: p.resource_type || "",
resource_id: p.resource_id != null ? p.resource_id : null,
detail: p.detail || null,
created_at: new Date(),
});
} catch (e) {
logs.error("[biz_audit] 写入失败", e);