|
|
|
@ -13,14 +13,14 @@ class MigrationInitializer: Initializer { |
|
|
|
|
}() |
|
|
|
|
|
|
|
|
|
init( |
|
|
|
|
account: Wallet, chainID: Int |
|
|
|
|
account: Wallet, chainID: Int |
|
|
|
|
) { |
|
|
|
|
self.account = account |
|
|
|
|
self.chainID = chainID |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func perform() { |
|
|
|
|
config.schemaVersion = 47 |
|
|
|
|
config.schemaVersion = 48 |
|
|
|
|
config.migrationBlock = { migration, oldSchemaVersion in |
|
|
|
|
switch oldSchemaVersion { |
|
|
|
|
case 0...32: |
|
|
|
@ -44,6 +44,15 @@ class MigrationInitializer: Initializer { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if oldSchemaVersion < 48 { |
|
|
|
|
migration.enumerateObjects(ofType: TokenObject.className()) { oldObject, newObject in |
|
|
|
|
guard let oldObject = oldObject else { return } |
|
|
|
|
guard let newObject = newObject else { return } |
|
|
|
|
if let contract = oldObject["contract"] as? String, contract == Constants.nullAddress { |
|
|
|
|
newObject["rawType"] = TokenType.ether.rawValue |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|