The Model has a field:
...
email: {
type: Sequelize.STRING,
allowNull: false,
unique: true
},
...
Which works fine when saving the model.
The update:
const user = await User.update(
{ email, <other fields> },
{ where: { id } }
)
It has to work if the user doesn’t change the e-mail or any other field. It should fail only if the e-mail is changed to another existing e-mail in database. I know in Laravel it has that option, but how to make that work in Sequelize?