postgrelize / UpsertOptions
Type Alias: UpsertOptions<T> ​
UpsertOptions<
T> =SaveOptions<T> &object
Defined in: src/model/write-options.ts:85
Options of upsert.
Extends SaveOptions. With onConflict the result of upsert becomes [instance, created].
Type Parameters ​
T ​
T = Values
Type Declaration ​
conflictFields? ​
optionalconflictFields?: readonlystring[]
Conflict target columns. Default: unique key containing a given attribute, else the primary key.
onConflict? ​
postgrelize extension
optionalonConflict?:OnConflictOptions<T>
Advanced ON CONFLICT handling; the result becomes [instance, created]. PostgreSQL extension.
overriding? ​
postgrelize extension
optionaloverriding?:"system"|"user"
OVERRIDING SYSTEM VALUE / OVERRIDING USER VALUE for identity columns.
See ​
Example ​
ts
const [user] = await User.upsert(
{ email: 'a@example.com', name: 'Ann' },
{ conflictFields: ['email'] },
);