Run migrations before delete_and_reset_all_device_msgs()

Both when importing a backup from file or receiving it over the network.
This commit is contained in:
link2xt
2023-04-02 08:12:23 +00:00
parent d6426dc1b6
commit f6d27516cb
2 changed files with 3 additions and 3 deletions

View File

@@ -397,8 +397,7 @@ async fn imex_inner(
export_backup(context, path, passphrase.unwrap_or_default()).await export_backup(context, path, passphrase.unwrap_or_default()).await
} }
ImexMode::ImportBackup => { ImexMode::ImportBackup => {
import_backup(context, path, passphrase.unwrap_or_default()).await?; import_backup(context, path, passphrase.unwrap_or_default()).await
context.sql.run_migrations(context).await
} }
} }
} }
@@ -474,6 +473,7 @@ async fn import_backup(
} }
} }
context.sql.run_migrations(context).await?;
delete_and_reset_all_device_msgs(context).await?; delete_and_reset_all_device_msgs(context).await?;
Ok(()) Ok(())

View File

@@ -407,8 +407,8 @@ async fn get_backup_inner(context: &Context, qr: Qr) -> Result<()> {
match transfer_from_provider(context, &ticket).await { match transfer_from_provider(context, &ticket).await {
Ok(()) => { Ok(()) => {
delete_and_reset_all_device_msgs(context).await?;
context.sql.run_migrations(context).await?; context.sql.run_migrations(context).await?;
delete_and_reset_all_device_msgs(context).await?;
context.emit_event(ReceiveProgress::Completed.into()); context.emit_event(ReceiveProgress::Completed.into());
Ok(()) Ok(())
} }