I'm currently working on an SailsJS app. I started to work with version 0.10.5 and implemented lots of models with inheritance between them. All was working fine.
Today, I decided to update my SailsJS project to version 0.11.0. I've read that the simplest way to do that was to update all SailsJS files with npm, then create a new project and finally copy all models, controllers, etc to the freshly created project. This is what I've done so far.
I'm now encountering an issue each time I try to lift my project :
/usr/local/lib/node_modules/sails/node_modules/waterline/node_modules/waterline-schema/lib/waterline-schema/foreignKeys.js:82
throw new Error('Trying to access a collection ' + collection + ' that is
^
Error: Trying to access a collection series that is not defined.
at ForeignKeys.findPrimaryKey (/usr/local/lib/node_modules/sails/node_modules/waterline/node_modules/waterline-schema/lib/waterline-schema/foreignKeys.js:82:11)
at ForeignKeys.replaceKeys (/usr/local/lib/node_modules/sails/node_modules/waterline/node_modules/waterline-schema/lib/waterline-schema/foreignKeys.js:53:27)
at new ForeignKeys (/usr/local/lib/node_modules/sails/node_modules/waterline/node_modules/waterline-schema/lib/waterline-schema/foreignKeys.js:30:10)
at new module.exports (/usr/local/lib/node_modules/sails/node_modules/waterline/node_modules/waterline-schema/lib/waterline-schema.js:30:17)
at Waterline.initialize (/usr/local/lib/node_modules/sails/node_modules/waterline/lib/waterline.js:107:17)
at buildORM (/usr/local/lib/node_modules/sails/lib/hooks/orm/build-orm.js:52:15)
at Array.async.auto.instantiatedCollections [as 1] (/usr/local/lib/node_modules/sails/lib/hooks/orm/index.js:203:11)
at listener (/usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:493:46)
at /usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:444:17
at Array.forEach (native)
at _each (/usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:46:24)
at Object.taskComplete (/usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:443:13)
at processImmediate [as _immediateCallback] (timers.js:345:15)
There are my models :
/api/services/OrthancObject.js
module.exports = {
attributes:
{
ID:
{
type: 'STRING',
primaryKey: true,
required: true
},
Type:
{
type: 'STRING',
required: true
},
MainDicomTags:
{
type: 'JSON',
required: true
}
}
}
/api/services/OrthancMutableObject.js
var OrthancObject = require('./OrthancObject.js');
module.exports = _.merge(_.cloneDeep(OrthancObject),
{
attributes:
{
IsStable:
{
type: 'BOOLEAN',
required: true
},
LastUpdate:
{
type: 'DATETIME',
required: true
}
}
});
/api/models/Patient.js
var OrthancMutableObject = require('../services/OrthancMutableObject.js');
module.exports = _.merge(_.cloneDeep(OrthancMutableObject),
{
attributes:
{
Studies:
{
collection: 'Study',
via: 'ParentPatient',
required: true
}
}
});
/api/models/Study.js
var OrthancMutableObject = require('../services/OrthancMutableObject.js');
module.exports = _.merge(_.cloneDeep(OrthancMutableObject),
{
attributes:
{
ParentPatient:
{
model: 'Patient',
required: true
},
Series:
{
collection: 'Series',
via: 'ParentStudy',
required: true
}
}
});
/api/models/Series.js
var OrthancMutableObject = require('../services/OrthancMutableObject.js');
module.exports = _.merge(_.cloneDeep(OrthancMutableObject),
{
attributes:
{
ExpectedNumberOfInstances:
{
type: 'INTEGER'
},
Instances:
{
collection: 'Instance',
via: 'ParentSeries',
required: true
},
ParentStudy:
{
model: 'Study',
required: true
},
Status:
{
type: 'STRING'
}
}
});
/api/models/Instance.js
var OrthancObject = require('../services/OrthancObject.js');
module.exports = _.merge(_.cloneDeep(OrthancObject),
{
attributes:
{
FileSize:
{
type: 'INTEGER',
required: true
},
FileUuid:
{
type: 'INTEGER',
required: true
},
IndexInSeries:
{
type: 'INTEGER',
required: true
},
ParentSeries:
{
model: 'Series'
}
}
});
Could you explain me what I am doing wrong ? I can't get why it isn't working anymore (reminder: it was working well in v 0.10.5).
Thanks for reading, Have a nice day :)