-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create add coinImage migrations field for enabledWallet using model f…
…or v_40
- Loading branch information
Showing
3 changed files
with
67 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
UnstoppableWallet/UnstoppableWallet/Models/Deprecated/EnabledWallet_v_0_40.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import GRDB | ||
import MarketKit | ||
|
||
class EnabledWallet_v_0_40: Record { | ||
let tokenQueryId: String | ||
let accountId: String | ||
|
||
let coinName: String? | ||
let coinCode: String? | ||
let tokenDecimals: Int? | ||
|
||
init(tokenQueryId: String, accountId: String, coinName: String? = nil, coinCode: String? = nil, tokenDecimals: Int? = nil) { | ||
self.tokenQueryId = tokenQueryId | ||
self.accountId = accountId | ||
self.coinName = coinName | ||
self.coinCode = coinCode | ||
self.tokenDecimals = tokenDecimals | ||
|
||
super.init() | ||
} | ||
|
||
override class var databaseTableName: String { | ||
"enabled_wallets" | ||
} | ||
|
||
enum Columns: String, ColumnExpression { | ||
case tokenQueryId, accountId, coinName, coinCode, tokenDecimals | ||
} | ||
|
||
required init(row: Row) throws { | ||
tokenQueryId = row[Columns.tokenQueryId] | ||
accountId = row[Columns.accountId] | ||
coinName = row[Columns.coinName] | ||
coinCode = row[Columns.coinCode] | ||
tokenDecimals = row[Columns.tokenDecimals] | ||
|
||
try super.init(row: row) | ||
} | ||
|
||
override func encode(to container: inout PersistenceContainer) { | ||
container[Columns.tokenQueryId] = tokenQueryId | ||
container[Columns.accountId] = accountId | ||
container[Columns.coinName] = coinName | ||
container[Columns.coinCode] = coinCode | ||
container[Columns.tokenDecimals] = tokenDecimals | ||
} | ||
} |