4

What is the best way to adding a User ID as an audit field within Sequelize? I'd like to capture the user ID of anyone who creates, updates, or deletes a record. For example:

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

... or ...

{
  tableName: 'user_profile',
  schema: 'authentication',
  timestamps: true,
  paranoid: true,
  createdBy: '_cu',
  createdAt: '_c',
  updatedBy: '_vu',
  updatedAt: '_v',
  deletedBy: '_du',
  deletedAt: '_d'
}
Fred Lackey
  • 2,351
  • 21
  • 34

0 Answers0