postgrelize / InsertOptions
Type Alias: InsertOptions<T> ​
InsertOptions<
T> =QueryOptionsBase&object
Defined in: src/model/write-options.ts:117
postgrelize extensionOptions of Model.insert. PostgreSQL extension.
Rows are inserted with a single INSERT and no per-row save hooks; only the bulk-create hooks run.
Type Parameters ​
T ​
T = Values
Type Declaration ​
fields? ​
optionalfields?: readonly (keyofT&string)[]
Attributes to insert; others are ignored. Default: all given attributes.
hooks? ​
optionalhooks?:boolean
Run beforeBulkCreate / afterBulkCreate hooks.
Default Value ​
trueonConflict? ​
optionalonConflict?:OnConflictOptions<T>
Advanced ON CONFLICT handling.
overriding? ​
optionaloverriding?:"system"|"user"
OVERRIDING SYSTEM VALUE / OVERRIDING USER VALUE for identity columns.
returningOld? ​
postgrelize extension
optionalreturningOld?:boolean
Return the pre-statement row values as instance.oldValues. PostgreSQL extension, needs PostgreSQL 18+.
validate? ​
optionalvalidate?:boolean
Validate rows before inserting.
Default Value ​
falseSee ​
Example ​
const opts: InsertOptions<User> = {
onConflict: { target: ['email'], action: 'nothing' },
hooks: false,
};
const rows = await User.insert([{ email: 'a@example.com' }], opts);