objectbox / objectbox/objectbox-dart

@Unique with replace strategy that update instead of deleting and inserting a new one

Open
#468 5 comments 13 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Dart
Stars
1.2k
Forks
162
Avg merge
15m
Merged PRs (30d)
1

Description

Right now, @Unique with conflict: ConflictStrategy.replace remove the old object and insert a new one, this behavior causes a null relation if there's data that has relation to the old object(the one before deleting), and after deleting and inserting a new object, the related item's relations aren't updated to the new object.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing an @Unique conflict using ConflictStrategy.replace with another object that has a relation to the existing object. Trace how the old object is removed and the replacement is inserted, then verify that related objects retain valid relations after the conflict is resolved. Done means replacement updates the existing object without leaving related data pointing at a deleted object.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.