MigrationContext

A data migration context providing access to the realm before and after an AutomaticSchemaMigration.

NOTE: All objects obtained from oldRealm and newRealm are only valid in the scope of the migration.

Properties

Link copied to clipboard

The realm after automatic schema migration.

Link copied to clipboard
abstract val oldRealm: DynamicRealm

The realm before automatic schema migration.

Functions

Link copied to clipboard
open fun enumerate(className: String, block: (oldObject: DynamicRealmObject, newObject: DynamicMutableRealmObject?) -> Unit)

Convenience method to iterate all objects of a certain class from the realm before migration with access to an updatable DynamicMutableRealmObject reference to the corresponding object in the already migrated realm. This makes it possible to do more advanced data mapping like merging or splitting field data or moving data while changing the type.