MCPcopy Index your code
hub / github.com/sequelize/sequelize / forEachModel

Method forEachModel

src/model-manager.js:111–128  ·  view source on GitHub ↗

* Iterate over Models in an order suitable for e.g. creating tables. * Will take foreign key constraints into account so that dependencies are visited before dependents. * * @param {Function} iterator method to execute on each model * @param {object} options * @private * * @depr

(iterator, options)

Source from the content-addressed store, hash-verified

109 * @deprecated
110 */
111 forEachModel(iterator, options) {
112 const sortedModels = this.getModelsTopoSortedByForeignKey();
113 if (sortedModels == null) {
114 throw new Error('Cyclic dependency found.');
115 }
116
117 options = _.defaults(options || {}, {
118 reverse: true
119 });
120
121 if (options.reverse) {
122 sortedModels.reverse();
123 }
124
125 for (const model of sortedModels) {
126 iterator(model);
127 }
128 }
129}
130
131module.exports = ModelManager;

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected