Change the db assets table to include the issuer column, and provide the db migration.
This commit is contained in:
parent
5739922bce
commit
535796b0be
7 changed files with 13 additions and 10 deletions
|
@ -2,11 +2,11 @@
|
|||
"formatVersion": 1,
|
||||
"database": {
|
||||
"version": 3,
|
||||
"identityHash": "36ac924b7b8d78fb2d937d1ff9ba8897",
|
||||
"identityHash": "5b34bbcb2a3774fb9db64655b7217bbc",
|
||||
"entities": [
|
||||
{
|
||||
"tableName": "assets",
|
||||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `symbol` TEXT NOT NULL, `precision` INTEGER NOT NULL, `description` TEXT NOT NULL, `bit_asset_id` TEXT NOT NULL, PRIMARY KEY(`id`))",
|
||||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `symbol` TEXT NOT NULL, `precision` INTEGER NOT NULL, `description` TEXT NOT NULL, `issuer` TEXT NOT NULL, PRIMARY KEY(`id`))",
|
||||
"fields": [
|
||||
{
|
||||
"fieldPath": "id",
|
||||
|
@ -33,8 +33,8 @@
|
|||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "bitAssetId",
|
||||
"columnName": "bit_asset_id",
|
||||
"fieldPath": "issuer",
|
||||
"columnName": "issuer",
|
||||
"affinity": "TEXT",
|
||||
"notNull": true
|
||||
}
|
||||
|
@ -409,7 +409,7 @@
|
|||
"views": [],
|
||||
"setupQueries": [
|
||||
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
|
||||
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, \"36ac924b7b8d78fb2d937d1ff9ba8897\")"
|
||||
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, \"5b34bbcb2a3774fb9db64655b7217bbc\")"
|
||||
]
|
||||
}
|
||||
}
|
|
@ -304,7 +304,7 @@ abstract class ConnectedActivity : AppCompatActivity(), ServiceConnection {
|
|||
_asset.symbol,
|
||||
_asset.precision,
|
||||
_asset.description ?: "",
|
||||
_asset.bitassetId ?: ""
|
||||
_asset.issuer ?: ""
|
||||
)
|
||||
|
||||
assets.add(asset)
|
||||
|
|
|
@ -88,7 +88,7 @@ class MainActivity : ConnectedActivity() {
|
|||
}
|
||||
|
||||
private fun startHandler() {
|
||||
mHandler.postDelayed(mRunnable, 30 * 1000) //for 3 minutes
|
||||
mHandler.postDelayed(mRunnable, 3 * 60 * 1000) //for 3 minutes
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
|
|
|
@ -68,6 +68,9 @@ abstract class BitsyDatabase : RoomDatabase() {
|
|||
override fun migrate(database: SupportSQLiteDatabase) {
|
||||
database.execSQL("DROP TABLE 'equivalent_values'")
|
||||
database.execSQL("CREATE TABLE IF NOT EXISTS 'equivalent_values' ('transfer_id' TEXT NOT NULL, 'value' INTEGER NOT NULL, 'symbol' TEXT NOT NULL, PRIMARY KEY(transfer_id, symbol), FOREIGN KEY (transfer_id) REFERENCES transfers(id))")
|
||||
|
||||
database.execSQL("DROP TABLE assets")
|
||||
database.execSQL("CREATE TABLE IF NOT EXISTS assets (`id` TEXT NOT NULL, `symbol` TEXT NOT NULL, `precision` INTEGER NOT NULL, `description` TEXT NOT NULL, `issuer` TEXT NOT NULL, PRIMARY KEY(`id`))")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,6 @@ interface AssetDao {
|
|||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
fun insertAll(assets: List<Asset>)
|
||||
|
||||
@Query("SELECT id, symbol, precision, description, bit_asset_id FROM assets INNER JOIN balances WHERE assets.id = balances.asset_id AND balances.asset_amount > 0")
|
||||
@Query("SELECT id, symbol, precision, description, issuer FROM assets INNER JOIN balances WHERE assets.id = balances.asset_id AND balances.asset_amount > 0")
|
||||
fun getAllNonZero(): LiveData<List<Asset>>
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ data class Asset(
|
|||
@ColumnInfo(name = "symbol") val symbol: String,
|
||||
@ColumnInfo(name = "precision") val precision: Int,
|
||||
@ColumnInfo(name = "description") val description: String,
|
||||
@ColumnInfo(name = "bit_asset_id") val bitAssetId: String
|
||||
@ColumnInfo(name = "issuer") val issuer: String
|
||||
) {
|
||||
override fun toString(): String {
|
||||
return symbol
|
||||
|
|
|
@ -233,7 +233,7 @@ class ReceiveTransactionFragment : ConnectedFragment() {
|
|||
_asset.symbol,
|
||||
_asset.precision,
|
||||
_asset.description ?: "",
|
||||
_asset.bitassetId ?: ""
|
||||
_asset.issuer ?: ""
|
||||
)
|
||||
|
||||
assets.add(asset)
|
||||
|
|
Loading…
Reference in a new issue