objectbox-dart
objectbox-dart copied to clipboard
@Unique: more on conflict options
Hello 👋
I ran into a problem with relationships that have a @Unique property. To be concise, an UPDATE strategy would be the solution. My problem has already been discussed in many PRs but not for objectbox-dart
.
https://github.com/objectbox/objectbox-dart/issues/297
This PR concerned the REPLACE
strategy. It works but my issue regarding this strategy is explained here: https://github.com/objectbox/objectbox-java/issues/1023#issuecomment-1014376019
@greenrobot-team But REPLACE doesn't automatically update the relations? If I have to check whether it got replaced during insert, then fix the relations manually it would be even more messy, I think.
After replacing duplications i end up with null relations which literally break my application.
https://github.com/objectbox/objectbox-java/issues/1023
So the UPDATE
strategy would be a great solution.
this enhancement will be very useful;
Suggestion Instead of adding more onConflict strategies, we can have the conflictedId one way or another in UniqueViolationException so we have the freedom how to handle that. Note this id appears in the message
similar to this https://github.com/objectbox/objectbox-java/issues/509#issue-344473626