Skip to content

Commit

Permalink
removing primary key from the migration object
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor Barros committed Jun 12, 2017
1 parent 90b841a commit d8ea386
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Kinvey/Kinvey/Migration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ open class Migration: NSObject {
if let oldObject = oldObject, let newObject = newObject {
let oldDictionary = oldObject.dictionaryWithValues(forKeys: oldProperties)

if let newDictionary = migrationObjectHandler?(oldDictionary) {
if var newDictionary = migrationObjectHandler?(oldDictionary) {
if let primaryKeyProperty = oldObjectSchema.primaryKeyProperty {
newDictionary.removeValue(forKey: primaryKeyProperty.name)
}
newObject.setValuesForKeys(newDictionary)
} else {
self.realmMigration.delete(newObject)
Expand Down

0 comments on commit d8ea386

Please sign in to comment.