Hello,
I have exprienced issue with following model. I am using jaguar_query_sqflite as adapter.
Consider two entity models Post and Tag with ManyToMany relationship.
In jaguar_orm, this results in 3 objects. Post, Tag and PostTag object representing single relation between Post and Tag
Generated beans using jaguar_orm_gen are _PostBean, _TagBean and _PostTagBean
_PostBean contains method remove with cascade named parameter
If cascade = true, _PostBean calls postTagBean.detachPost(newModel);
postTagBean.detachPost has following code
Future<int> detachPost(Post model) async {
final dels = await findByPost(model.id);
await removeByPost(model.id);
final exp = Or();
for (final t in dels) {
exp.or(tagBean.id.eq(t.tagId));
}
return await tagBean.removeWhere(exp);
}
Hovewer, if relationship is optional and we want to remove Post with no Tags this results in generating empty Or which is not valid SQL
Hello, I have exprienced issue with following model. I am using jaguar_query_sqflite as adapter.