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 withValue:(id)value
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.
Deletes the data for the class with the given name. This deletes all objects of the given class, and if the RLMObject subclass no longer exists in your program, cleans up any remaining metadata for the class in the Realm file.
- (BOOL)deleteDataForClassName:(NSString *)name
The name of the RLMObject class to delete.
whether there was any data to delete.
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.