MCPcopy
hub / github.com/sequelize/sequelize / define

Method define

src/sequelize.js:462–471  ·  view source on GitHub ↗

* Define a new model, representing a table in the database. * * The table columns are defined by the object that is given as the second argument. Each key of the object represents a column * * @param {string} modelName The name of the model. The model will be stored in `sequelize.models`

(modelName, attributes, options = {})

Source from the content-addressed store, hash-verified

460 * sequelize.models.modelName // The model will now be available in models under the name given to define
461 */
462 define(modelName, attributes, options = {}) {
463 options.modelName = modelName;
464 options.sequelize = this;
465
466 const model = class extends Model {};
467
468 model.init(attributes, options);
469
470 return model;
471 }
472
473 /**
474 * Fetch a Model which is already defined

Callers 15

error.test.jsFile · 0.80
schema.test.jsFile · 0.80
cls.test.jsFile · 0.80
trigger.test.jsFile · 0.80
data-types.test.jsFile · 0.80
testSuccessFunction · 0.80
timezone.test.jsFile · 0.80
utils.test.jsFile · 0.80
model.test.jsFile · 0.80

Calls 1

initMethod · 0.80

Tested by 11

testSuccessFunction · 0.64
verifyDeadlockFunction · 0.64
createUsersAndItemsFunction · 0.64
executeTestFunction · 0.64
checkTimezoneParsingFunction · 0.64
reloadDynamicOIDsFunction · 0.64
testsqlFunction · 0.64
applyFailTestFunction · 0.64
applyPassTestFunction · 0.64