Introducing an optional field called bts_value in the Transfer entity
This commit is contained in:
parent
032c627725
commit
a10c527956
3 changed files with 14 additions and 5 deletions
|
@ -2,7 +2,7 @@
|
||||||
"formatVersion": 1,
|
"formatVersion": 1,
|
||||||
"database": {
|
"database": {
|
||||||
"version": 3,
|
"version": 3,
|
||||||
"identityHash": "5b34bbcb2a3774fb9db64655b7217bbc",
|
"identityHash": "01c36f5fcfeb86c75594b083f9b82894",
|
||||||
"entities": [
|
"entities": [
|
||||||
{
|
{
|
||||||
"tableName": "assets",
|
"tableName": "assets",
|
||||||
|
@ -177,7 +177,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"tableName": "transfers",
|
"tableName": "transfers",
|
||||||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `block_number` INTEGER NOT NULL, `timestamp` INTEGER NOT NULL, `fee_amount` INTEGER NOT NULL, `fee_asset_id` TEXT NOT NULL, `source` TEXT NOT NULL, `destination` TEXT NOT NULL, `transfer_amount` INTEGER NOT NULL, `transfer_asset_id` TEXT NOT NULL, `memo` TEXT NOT NULL, PRIMARY KEY(`id`))",
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `block_number` INTEGER NOT NULL, `timestamp` INTEGER NOT NULL, `fee_amount` INTEGER NOT NULL, `fee_asset_id` TEXT NOT NULL, `source` TEXT NOT NULL, `destination` TEXT NOT NULL, `transfer_amount` INTEGER NOT NULL, `transfer_asset_id` TEXT NOT NULL, `memo` TEXT NOT NULL, `bts_value` INTEGER, PRIMARY KEY(`id`))",
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"fieldPath": "id",
|
"fieldPath": "id",
|
||||||
|
@ -238,6 +238,12 @@
|
||||||
"columnName": "memo",
|
"columnName": "memo",
|
||||||
"affinity": "TEXT",
|
"affinity": "TEXT",
|
||||||
"notNull": true
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "btsValue",
|
||||||
|
"columnName": "bts_value",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"primaryKey": {
|
"primaryKey": {
|
||||||
|
@ -409,7 +415,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, \"5b34bbcb2a3774fb9db64655b7217bbc\")"
|
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, \"01c36f5fcfeb86c75594b083f9b82894\")"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -69,6 +69,8 @@ abstract class BitsyDatabase : RoomDatabase() {
|
||||||
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("ALTER TABLE transfers ADD bts_value INTEGER")
|
||||||
|
|
||||||
database.execSQL("DROP TABLE assets")
|
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`))")
|
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`))")
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,5 +16,6 @@ data class Transfer (
|
||||||
@ColumnInfo(name = "destination") val destination: String, // TODO should be foreign key to UserAccount
|
@ColumnInfo(name = "destination") val destination: String, // TODO should be foreign key to UserAccount
|
||||||
@ColumnInfo(name = "transfer_amount") val transferAmount: Long,
|
@ColumnInfo(name = "transfer_amount") val transferAmount: Long,
|
||||||
@ColumnInfo(name = "transfer_asset_id") val transferAssetId: String, // TODO should be foreign key to Asset
|
@ColumnInfo(name = "transfer_asset_id") val transferAssetId: String, // TODO should be foreign key to Asset
|
||||||
@ColumnInfo(name = "memo") val memo: String
|
@ColumnInfo(name = "memo") val memo: String,
|
||||||
|
@ColumnInfo(name = "bts_value") val btsValue: Long? = -1
|
||||||
)
|
)
|
Loading…
Reference in a new issue