Open twolfson opened 9 years ago
I agree. I don't use .load
personally, and load models my own way:
files = "model1 model2 model3".split(' ');
for (var i = 0; i < files.length; i++) {
require("./" + files[i])(orm, db);
}
If the models only load once and can't be used until they've loaded, synchronous (blocking) actually makes sense here. If the app requires the DB, then instead of having to check if it's initialized in every call, I'd rather block during app load. I'm facing a similar issue with another ORM.
Inside of
db.load
, there is no reason for it to be an asynchronous function. We should make it synchronous and deprecate thecb
functionality.