MigrationContext

interface 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.

Functions

enumerate
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.

Properties

newRealm
Link copied to clipboard
abstract val newRealm: DynamicMutableRealm
The realm after automatic schema migration.
oldRealm
Link copied to clipboard
abstract val oldRealm: DynamicRealm
The realm before automatic schema migration.