postgrelize / UpdateOptions
Type Alias: UpdateOptions<T> ​
UpdateOptions<
T> =QueryOptionsBase&object&object&BulkHookOptions
Defined in: src/model/bulk-options.ts:92
Options of static update.
Extends BulkHookOptions. Updates updatedAt unless silent.
Type Parameters ​
T ​
T = Values
Type Declaration ​
fields? ​
optionalfields?: readonly (keyofT&string)[]
Attributes to update; others are ignored. Mutable so hooks can adjust it, as in v6.
from? ​
postgrelize extension
optionalfrom?:JoinSources
Extra relations (UPDATE ... FROM), keyed by alias; reference them with col('alias.attr'). PostgreSQL extension.
paranoid? ​
optionalparanoid?:boolean
For paranoid models: false also updates soft-deleted rows.
Default Value ​
truereturning? ​
optionalreturning?:boolean
Return updated rows as the second element of the result.
returningOld? ​
postgrelize extension
optionalreturningOld?:boolean
With returning: expose values before the update as instance.oldValues. PostgreSQL extension, needs PostgreSQL 18+.
silent? ​
optionalsilent?:boolean
Do not update updatedAt.
Default Value ​
falsevalidate? ​
optionalvalidate?:boolean
Validate the new values.
Default Value ​
truewhere ​
where:
WhereOptions<T>
Rows to update.
See ​
Example ​
const [count] = await User.update(
{ active: false },
{ where: { lastLogin: { [Op.lt]: new Date('2020-01-01') } }, transaction },
);
const opts: UpdateOptions<Task> = { where: { done: false }, returning: true };