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

Commit 72925cf7 by Marquitos Committed by GitHub

fix: add missing fields to 'FindOrCreateType' (#12338)

1 parent f3671912
Showing with 17 additions and 4 deletions
...@@ -685,12 +685,11 @@ export interface Hookable { ...@@ -685,12 +685,11 @@ export interface Hookable {
/** /**
* Options for Model.findOrCreate method * Options for Model.findOrCreate method
*/ */
export interface FindOrCreateOptions extends Logging, Transactionable { export interface FindOrCreateOptions extends Filterable, Logging, Transactionable {
/** /**
* A hash of search attributes. * The fields to insert / update. Defaults to all fields
*/ */
where: WhereOptions; fields?: string[];
/** /**
* Default values to use if building a new instance * Default values to use if building a new instance
*/ */
......
...@@ -99,6 +99,20 @@ UserModel.findCreateFind({ ...@@ -99,6 +99,20 @@ UserModel.findCreateFind({
}) })
/** /**
* Tests for findOrCreate() type.
*/
UserModel.findOrCreate({
fields: [ "jane.doe" ],
where: {
username: "jane.doe"
},
defaults: {
username: "jane.doe"
}
})
/**
* Test for primaryKeyAttributes. * Test for primaryKeyAttributes.
*/ */
class TestModel extends Model {}; class TestModel extends Model {};
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!