Skip to content

Orphaned embedded objects are not deleted when migrating from Object to Embedded Object #6073

@jlachewitz

Description

@jlachewitz

How frequently does the bug occur?

Always

Description

This issue has previously been noted and resolved in realm-java and realm-kotlin:

realm/realm-java#7769
realm/realm-kotlin#1464

Orphaned documents should be handled automatically according to this change in realm-core:
realm/realm-core#5737

The issue occurs when migrating a schema for a local realm. Version 2 of the schema has three object models defined. Version 3 of the schema embeds each of these three object models into one another in order to take advantage of cascading deletes. When the existing realm is attempted to be migrated from version 2 to 3, the following error is received:

"Failed to open local Realm for {REALM_INSTANCE} - Error: ","args":["Cannot convert '{OBJECT}' to embedded: at least one object has no incoming links and would be deleted."]

Stacktrace & log output

"Failed to open local Realm for {REALM_INSTANCE} - Error: ","args":["Cannot convert '{OBJECT}' to embedded: at least one object has no incoming links and would be deleted."]

Can you reproduce the bug?

Always

Reproduction Steps

No response

Version

11.3.1

What services are you using?

Local Database only

Are you using encryption?

  • select --

Platform OS and version(s)

Electron 22.3.14

Build environment

Which debugger for React Native: ..

Cocoapods version

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions