不要怂,就是干,撸起袖子干!

Commit a676eea0 by Justin Abene Committed by Sushant

fix(typings): upsert options (#10655)

1 parent ea5afbfd
Showing with 34 additions and 4 deletions
......@@ -559,14 +559,24 @@ export interface FindOrCreateOptions extends Logging, Transactionable {
*/
export interface UpsertOptions extends Logging, Transactionable, SearchPathable {
/**
* Run validations before the row is inserted
* The fields to insert / update. Defaults to all fields
*/
validate?: boolean;
fields?: string[];
/**
* The fields to insert / update. Defaults to all fields
* Run before / after bulk create hooks?
*/
fields?: string[];
hooks?: boolean;
/**
* Return the affected rows (only for postgres)
*/
returning?: boolean;
/**
* Run validations before the row is inserted
*/
validate?: boolean;
}
/**
......
import {Model} from "sequelize"
import {sequelize} from './connection';
class TestModel extends Model {
}
TestModel.init({}, {sequelize})
sequelize.transaction(trx => {
return TestModel.upsert({}, {
benchmark: true,
fields: ['testField'],
hooks: true,
logging: true,
returning: true,
searchPath: 'DEFAULT',
transaction: trx,
validate: true,
})
})
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!