I have encountered a problem that I can't fathom. Please, if anyone can see what I did wrong, I would appreciate the help greatly.
I have two models, CvDevice and CvAccessMap, with a 1:M relation between them, as cv_device.id = cv_access_map.device_id
When I call build(), I get the following error:
Error: relation type "BelongsToOneRelation" is not supported in SchemaBuilder.js, in function
_relationField(modelData, relation) {
if (relation instanceof objection.HasOneRelation
|| relation instanceof objection.BelongsToOneRelation
|| relation instanceof objection.HasOneThroughRelation) {
return {
type: this._typeForModel(modelData),
args: _.omit(modelData.args, OMIT_FROM_RELATION_ARGS),
}
} else if (relation instanceof objection.HasManyRelation || relation instanceof objection.ManyToManyRelation) {
return {
type: new GraphQLList(this._typeForModel(modelData)),
args: _.omit(modelData.args, OMIT_FROM_RELATION_ARGS),
}
}
throw new Error(`relation type "${relation.constructor.name}" is not supported on ${modelData.modelClass.tableName}`)
}
The two models look fine, I really can't see what could be causing this. I have tried several things, but it seems like the relation type is not correctly assigned a Model relation class as expected.
This was previously working with objection: ^0.9.4 and objection-graphql: ^0.2.3.
I've recently upgraded to objection: ^1.3.0 and objection-graphql: ^0.4.2.
Obviously something substantial has changed, but I can't see what.
Hi,
I have encountered a problem that I can't fathom. Please, if anyone can see what I did wrong, I would appreciate the help greatly.
I have two models, CvDevice and CvAccessMap, with a 1:M relation between them, as cv_device.id = cv_access_map.device_id
When I call build(), I get the following error: Error: relation type "BelongsToOneRelation" is not supported in SchemaBuilder.js, in function
The two models look fine, I really can't see what could be causing this. I have tried several things, but it seems like the relation type is not correctly assigned a Model relation class as expected.
This was previously working with objection: ^0.9.4 and objection-graphql: ^0.2.3. I've recently upgraded to objection: ^1.3.0 and objection-graphql: ^0.4.2.
Obviously something substantial has changed, but I can't see what.
Any and all help will be appreciated!
Here is the code for the build():
and the two models:
and
Thanks in advance, Adrian