Skip to content

Commit

Permalink
fix bug in while loop
Browse files Browse the repository at this point in the history
  • Loading branch information
laruh committed Oct 28, 2024
1 parent 1e9ee0c commit e4c59f8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mm2src/coins/nft/storage/sql_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1467,7 +1467,9 @@ impl NftMigrationOps for AsyncMutexGuard<'_, AsyncConnection> {
while version < CURRENT_SCHEMA_VERSION_TX_HISTORY {
match version {
0 => {
migrate_tx_history_table_to_schema_v2(conn, history_table.clone(), schema_table.clone())?;
migrate_tx_history_table_to_schema_v2(conn, history_table, schema_table)?;
// Stop the while loop after performing the upgrade for version 0, as in function above we already made schema up to date
break;
},
1 => {
// The Tx History SQL schema didn't have version 1, but let's handle this case
Expand Down
6 changes: 6 additions & 0 deletions mm2src/coins/nft/storage/wasm/wasm_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -932,6 +932,8 @@ impl TableSignature for NftListTable {
)?;
table.create_index("chain", false)?;
table.create_index("block_number", false)?;
// Stop the while loop after performing the upgrade for version 0
break;
},
1 => {
// nothing to change
Expand Down Expand Up @@ -1031,6 +1033,8 @@ impl TableSignature for NftTransferHistoryTable {
table.create_multi_index(CHAIN_IMAGE_DOMAIN_INDEX, &["chain", "image_domain"], false)?;
table.create_index("block_number", false)?;
table.create_index("chain", false)?;
// Stop the while loop after performing the upgrade for version 0
break;
},
1 => {
let table = upgrader.open_table(Self::TABLE_NAME)?;
Expand Down Expand Up @@ -1071,6 +1075,8 @@ impl TableSignature for LastScannedBlockTable {
0 => {
let table = upgrader.create_table(Self::TABLE_NAME)?;
table.create_index("chain", true)?;
// Stop the while loop after performing the upgrade for version 0
break;
},
1 => {
// nothing to change
Expand Down

0 comments on commit e4c59f8

Please sign in to comment.