How to pass in transaction object to be use in custom validation/model validation? hooks can access it via options object
sequelize.define('Model', {
username: {
type: DataType.STRING,
validate: {
customValidation: function(value) {
// how to get transaction object here?
// someQuery
}
}
}
}, {
hooks: {
beforeCreate: function(instance, options, fn) {
// here we got options.transaction <== like this
}
});