mirror of
https://github.com/chatmail/core.git
synced 2026-05-07 17:06:35 +03:00
Fix: Run migrations after importing backup again (#3006)
As of #2980, the migrations were not run after importing a backup. This lead to errors like "Failed to send message: no such table: smtp" if you imported a backup from a previous DC version.
This commit is contained in:
@@ -1,5 +1,9 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## Unreleased
|
||||||
|
|
||||||
|
fix: run migrations on backup import #3006
|
||||||
|
|
||||||
## 1.71.0
|
## 1.71.0
|
||||||
|
|
||||||
### API Changes
|
### API Changes
|
||||||
|
|||||||
@@ -423,7 +423,8 @@ 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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -215,6 +215,12 @@ impl Sql {
|
|||||||
conn.pragma_update(None, "synchronous", &"NORMAL".to_string())?;
|
conn.pragma_update(None, "synchronous", &"NORMAL".to_string())?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.run_migrations(context).await?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn run_migrations(&self, context: &Context) -> Result<()> {
|
||||||
// (1) update low-level database structure.
|
// (1) update low-level database structure.
|
||||||
// this should be done before updates that use high-level objects that
|
// this should be done before updates that use high-level objects that
|
||||||
// rely themselves on the low-level structure.
|
// rely themselves on the low-level structure.
|
||||||
|
|||||||
Reference in New Issue
Block a user