project-imas / encrypted-core-data

v2.0 - iOS Core Data encrypted SQLite store using SQLCipher
Other
785 stars 236 forks source link

Handle self-referential asymmetric many-to-many relationships #265

Closed patrickhartling closed 7 years ago

patrickhartling commented 7 years ago

I ran into an issue in the ECD many-to-many relationship support. To reproduce the problem, the following must exist in the managed object model:

I added a test case that demonstrates the problem with using NSFetchRequest when that exists. There is an Account entity with two many-to-many relationships: transferToAccounts (the destination Accounts) and transferFromAccounts (the receiving Accounts).

The patch I made fixes my problem, but I suspect that it would introduce an incompatibility with existing databases that have many-to-many relationships. I do not know how to resolve that.

patrickhartling commented 7 years ago

@danielbroad Have you had a chance to look at this? If there is a better way to solve the issue, I would be happy to try it.

DanielBroad commented 7 years ago

I know i need to check this over. Because its not backwards compatible i'm not sure how to proceed.