when using cradle if we don't wait for the schema to be connected, the models fails to load correctly.
This commit is contained in:
parent
75c96bdaa9
commit
fa50e0e5e8
|
@ -28,6 +28,9 @@ if (existsSync(confFile)) {
|
|||
|
||||
var schema = new Schema(config && config.driver || 'memory', config);
|
||||
schema.log = log;
|
||||
|
||||
// when using cradle if we dont wait for the schema to be connected, the models fails to load correctly.
|
||||
schema.on('connected', function() {
|
||||
railway.orm._schemas.push(schema);
|
||||
|
||||
context = prepareContext(schema);
|
||||
|
@ -50,6 +53,7 @@ if (schemaFile) {
|
|||
railway.orm._schemas.forEach(function (schema) {
|
||||
schema.freeze();
|
||||
});
|
||||
});
|
||||
|
||||
// check validations and display warning
|
||||
|
||||
|
|
Loading…
Reference in New Issue