-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deleting Orphaned Objects during Realm Migration #7139
Comments
@saltyskip This change came with realm/realm-core#4414 in core. Please also refer to the discussion (and all the linked issues) in there. TL;DR We chose to go the safer path of option (2). When migrating to an |
Hi I see, I've updated my codes to manually remove the orphaned objects, it might be nice to either have a configuration setting to delete orphans automatically or update documentation examples of migrations to show how to safely delete orphaned objects during migration. I think its safe to delete this issue. Thanks @DominicFrei |
Thanks for letting us know, @saltyskip. I did create a ticket to include a helper function to make deleting those orphaned objects easier: #7145 I've also noted that an update of the documentation would be a good idea. 👍 |
Goals
I want to migrate existing data base stores to embedded. There maybe some objects that have been unintentionally orphaned due to developer error. I want to migrate the objects to embedded and either ignore or delete orphaned objects in the process
Expected Results
Successful migration, if there are any objects that do not have a parent object they should be deleted.
Actual Results
Steps for others to Reproduce
Create several parent child relationships. Create an orphaned child object
Parent A -> Child B
Child C
When you run the migration you will get the error above due to the existance of child C. In migration block I want to delete child C if that is the case.
Code Sample
Version of Realm and Tooling
Realm framework version: Realm 10.7.0
Xcode version: 12.4
iOS/OSX version: 14.4
The text was updated successfully, but these errors were encountered: