将用户ID添加到Sequelize Audit Fields(createdBy,updatedBy,deletedBy)

时间:2017-10-25 15:24:53

标签: sequelize.js sequelize-cli

在Sequelize中添加用户ID作为审核字段的最佳方法是什么?我想捕获创建,更新或删除记录的任何人的用户ID。例如:

{
  tableName: 'user_profile',
  schema: 'authentication',
  timestamps: true,
  paranoid: true,
  auditUser: '_u',
  createdAt: '_c',
  updatedAt: '_v',
  deletedAt: '_d'
}

......或......

{
  tableName: 'user_profile',
  schema: 'authentication',
  timestamps: true,
  paranoid: true,
  createdBy: '_cu',
  createdAt: '_c',
  updatedBy: '_vu',
  updatedAt: '_v',
  deletedBy: '_du',
  deletedAt: '_d'
}

0 个答案:

没有答案