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

Method define

lib/sequelize.js:451–460  ·  lib/sequelize.js::Sequelize.define

* 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

449 * sequelize.models.modelName class="cm">// The model will now be available in models under the name given to define
450 */
451 define(modelName, attributes, options = {}) {
452 options.modelName = modelName;
453 options.sequelize = this;
454
455 const model = class extends Model {};
456
457 model.init(attributes, options);
458
459 return model;
460 }
461
462 /**
463 * Fetch a Model which is already defined

Callers 15

model.tsFile · 0.80
define.tsFile · 0.80
docs-example.tsFile · 0.80
Define.tsFile · 0.80
ModelInit.tsFile · 0.80
constructorMethod · 0.80
error.test.jsFile · 0.80
schema.test.jsFile · 0.80
cls.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