RLMMigration Class Reference
RLMMigration is the object passed into a user defined RLMMigrationBlock when updating the version of an RLMRealm instance.
This object provides access to the RLMSchema current to this migration.
Altering Objects during a Migration
@property (nonatomic, readonly) RLMSchema *newSchema
Create an RLMObject of type
className in the Realm being migrated.
- (RLMObject *)createObject:(NSString *)className withObject:(id)object
The name of the RLMObject class to create.
The value used to populate the created object. This can be any key/value coding compliant object, or a JSON object such as those returned from the methods in NSJSONSerialization, or an NSArray with one object for each persisted property. An exception will be thrown if any required properties are not present and no default is set.
When passing in an NSArray, all properties must be present, valid and in the same order as the properties defined in the model.
Delete an object from a Realm during a migration. This can be called within
- (void)deleteObject:(RLMObject *)object
Object to be deleted from the Realm being migrated.
Enumerates objects of a given type in this Realm, providing both the old and new versions of each object. Objects properties can be accessed using keyed subscripting.
- (void)enumerateObjects:(NSString *)className block:(RLMObjectMigrationBlock)block
The name of the RLMObject class to enumerate.
Warning: All objects returned are of a type specific to the current migration and should not be casted to className. Instead you should access them as RLMObjects and use keyed subscripting to access properties.