MCPcopy
hub / github.com/sequelize/sequelize / create

Method create

src/model.js:2302–2312  ·  view source on GitHub ↗

* Builds a new model instance and calls save on it. * * @see * Model.build * @see * Model.save * * @param {object} values Hash of data values to create new record with * @param {object} [options] Build

(values, options)

Source from the content-addressed store, hash-verified

2300 *
2301 */
2302 static async create(values, options) {
2303 options = Utils.cloneDeep(options || {});
2304
2305 return await this.build(values, {
2306 isNewRecord: true,
2307 attributes: options.fields,
2308 include: options.include,
2309 raw: options.raw,
2310 silent: options.silent
2311 }).save(options);
2312 }
2313
2314 /**
2315 * Find a row that matches the query, or build (but don't save) the row if none is found.

Callers 15

findOrCreateMethod · 0.95
findCreateFindMethod · 0.95
sscce.jsFile · 0.45
expectsqlFunction · 0.45
expectPerDialectFunction · 0.45
error.test.jsFile · 0.45
schema.test.jsFile · 0.45
cls.test.jsFile · 0.45
testHooksFunction · 0.45
executeFunction · 0.45
trigger.test.jsFile · 0.45

Calls 2

buildMethod · 0.95
saveMethod · 0.80

Tested by 13

testHooksFunction · 0.36
executeFunction · 0.36
testSuccessFunction · 0.36
testAsyncFunction · 0.36
updateFunction · 0.36
verifyDeadlockFunction · 0.36
newTransactionFuncFunction · 0.36
executeTestFunction · 0.36
checkTimezoneParsingFunction · 0.36
describeDeferrableTestFunction · 0.36