Fix db migration for the transfers table and for transfers of other asset than BTS, so that its propper bts_value can be fetched later.

This commit is contained in:
Severiano Jaramillo 2019-02-07 10:26:09 -06:00
parent e4dce3cad4
commit d36de0b30a

View file

@ -70,6 +70,7 @@ abstract class BitsyDatabase : RoomDatabase() {
database.execSQL("ALTER TABLE transfers ADD bts_value INTEGER") database.execSQL("ALTER TABLE transfers ADD bts_value INTEGER")
database.execSQL("UPDATE transfers SET bts_value = transfer_amount WHERE transfer_asset_id = '1.3.0'") database.execSQL("UPDATE transfers SET bts_value = transfer_amount WHERE transfer_asset_id = '1.3.0'")
database.execSQL("UPDATE transfers SET bts_value = -1 WHERE transfer_asset_id != '1.3.0'")
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`))")