diff --git a/mm2src/coins/nft/storage/sql_storage.rs b/mm2src/coins/nft/storage/sql_storage.rs index c1192a445f..18f406a2db 100644 --- a/mm2src/coins/nft/storage/sql_storage.rs +++ b/mm2src/coins/nft/storage/sql_storage.rs @@ -164,7 +164,7 @@ fn create_schema_versions_sql() -> Result { let sql = format!( "CREATE TABLE IF NOT EXISTS {} ( table_name TEXT PRIMARY KEY, - version INTEGER NOT NULL, + version INTEGER NOT NULL );", safe_table_name.inner() ); @@ -520,9 +520,16 @@ fn update_transfer_spam_by_token_addr_id(chain: &Chain) -> Result String { format!( - "UPDATE {} SET version = ?1 WHERE table_name = ?2;", + "INSERT INTO {} (table_name, version) + VALUES (?1, ?2) + ON CONFLICT(table_name) DO UPDATE SET version = excluded.version;", schema_versions.inner() ) } @@ -1443,8 +1450,8 @@ fn migrate_tx_history_table_schema( sql_tx.execute(&rename_table_sql, [])?; sql_tx.execute(&update_schema_version_sql(&schema_table), [ - CURRENT_SCHEMA_VERSION_TX_HISTORY.to_string(), history_table.inner().to_string(), + CURRENT_SCHEMA_VERSION_TX_HISTORY.to_string(), ])?; sql_tx.commit()?;