fix(sql): don't panic on missing migration when preload is enabled (#1932)

Co-authored-by: Fabian-Lars <fabianlars@fabianlars.de>
pull/1928/head^2
凊弦凝绝 8 months ago committed by GitHub
parent 74ee7edc43
commit aef5dd6157
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -145,7 +145,9 @@ impl Builder {
for db in config.preload {
let pool = DbPool::connect(&db, app).await?;
if let Some(migrations) = self.migrations.as_mut().unwrap().remove(&db) {
if let Some(migrations) =
self.migrations.as_mut().and_then(|mm| mm.remove(&db))
{
let migrator = Migrator::new(migrations).await?;
pool.migrate(&migrator).await?;
}

Loading…
Cancel
Save