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,
|
"formatVersion": 1,
|
||||||
"database": {
|
"database": {
|
||||||
"version": 3,
|
"version": 3,
|
||||||
"identityHash": "36ac924b7b8d78fb2d937d1ff9ba8897",
|
"identityHash": "5b34bbcb2a3774fb9db64655b7217bbc",
|
||||||
"entities": [
|
"entities": [
|
||||||
{
|
{
|
||||||
"tableName": "assets",
|
"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": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"fieldPath": "id",
|
"fieldPath": "id",
|
||||||
|
@ -33,8 +33,8 @@
|
||||||
"notNull": true
|
"notNull": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldPath": "bitAssetId",
|
"fieldPath": "issuer",
|
||||||
"columnName": "bit_asset_id",
|
"columnName": "issuer",
|
||||||
"affinity": "TEXT",
|
"affinity": "TEXT",
|
||||||
"notNull": true
|
"notNull": true
|
||||||
}
|
}
|
||||||
|
@ -409,7 +409,7 @@
|
||||||
"views": [],
|
"views": [],
|
||||||
"setupQueries": [
|
"setupQueries": [
|
||||||
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
|
"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.symbol,
|
||||||
_asset.precision,
|
_asset.precision,
|
||||||
_asset.description ?: "",
|
_asset.description ?: "",
|
||||||
_asset.bitassetId ?: ""
|
_asset.issuer ?: ""
|
||||||
)
|
)
|
||||||
|
|
||||||
assets.add(asset)
|
assets.add(asset)
|
||||||
|
|
|
@ -88,7 +88,7 @@ class MainActivity : ConnectedActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun startHandler() {
|
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 {
|
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||||
|
|
|
@ -68,6 +68,9 @@ abstract class BitsyDatabase : RoomDatabase() {
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(database: SupportSQLiteDatabase) {
|
||||||
database.execSQL("DROP TABLE 'equivalent_values'")
|
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("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)
|
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||||
fun insertAll(assets: List<Asset>)
|
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>>
|
fun getAllNonZero(): LiveData<List<Asset>>
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ data class Asset(
|
||||||
@ColumnInfo(name = "symbol") val symbol: String,
|
@ColumnInfo(name = "symbol") val symbol: String,
|
||||||
@ColumnInfo(name = "precision") val precision: Int,
|
@ColumnInfo(name = "precision") val precision: Int,
|
||||||
@ColumnInfo(name = "description") val description: String,
|
@ColumnInfo(name = "description") val description: String,
|
||||||
@ColumnInfo(name = "bit_asset_id") val bitAssetId: String
|
@ColumnInfo(name = "issuer") val issuer: String
|
||||||
) {
|
) {
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
return symbol
|
return symbol
|
||||||
|
|
|
@ -233,7 +233,7 @@ class ReceiveTransactionFragment : ConnectedFragment() {
|
||||||
_asset.symbol,
|
_asset.symbol,
|
||||||
_asset.precision,
|
_asset.precision,
|
||||||
_asset.description ?: "",
|
_asset.description ?: "",
|
||||||
_asset.bitassetId ?: ""
|
_asset.issuer ?: ""
|
||||||
)
|
)
|
||||||
|
|
||||||
assets.add(asset)
|
assets.add(asset)
|
||||||
|
|
Loading…
Reference in a new issue