Skip to content

Commit cec23a4

Browse files
GoodjooyFabianLars
authored andcommitted
fix(sql): don't panic on missing migration when preload is enabled (tauri-apps#1932)
Co-authored-by: Fabian-Lars <[email protected]>
1 parent 072853e commit cec23a4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

plugins/sql/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,9 @@ impl Builder {
145145
for db in config.preload {
146146
let pool = DbPool::connect(&db, app).await?;
147147

148-
if let Some(migrations) = self.migrations.as_mut().unwrap().remove(&db) {
148+
if let Some(migrations) =
149+
self.migrations.as_mut().and_then(|mm| mm.remove(&db))
150+
{
149151
let migrator = Migrator::new(migrations).await?;
150152
pool.migrate(&migrator).await?;
151153
}

0 commit comments

Comments
 (0)