WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 780d60b

Browse files
committed
Fix include ignored migration rerunning (#41114)
Closes #ISSUE Release Notes: - Fixed an issue where having a correct `file_finder.include_ignored` setting would result in failed to migrate errors
1 parent 08ba193 commit 780d60b

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

crates/migrator/src/migrations/m_2025_10_17/settings.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ pub fn make_file_finder_include_ignored_an_enum(value: &mut Value) -> Result<()>
1717
Value::Bool(true) => Value::String("all".to_string()),
1818
Value::Bool(false) => Value::String("indexed".to_string()),
1919
Value::Null => Value::String("smart".to_string()),
20+
Value::String(s) if s == "all" || s == "indexed" || s == "smart" => return Ok(()),
2021
_ => anyhow::bail!("Expected include_ignored to be a boolean or null"),
2122
};
2223
Ok(())

crates/migrator/src/migrator.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,13 @@ mod tests {
366366
#[track_caller]
367367
fn assert_migrate_settings(input: &str, output: Option<&str>) {
368368
let migrated = migrate_settings(input).unwrap();
369-
assert_migrated_correctly(migrated, output);
369+
assert_migrated_correctly(migrated.clone(), output);
370+
371+
// expect that rerunning the migration does not result in another migration
372+
if let Some(migrated) = migrated {
373+
let rerun = migrate_settings(&migrated).unwrap();
374+
assert_migrated_correctly(rerun, None);
375+
}
370376
}
371377

372378
#[track_caller]
@@ -376,7 +382,13 @@ mod tests {
376382
output: Option<&str>,
377383
) {
378384
let migrated = run_migrations(input, migrations).unwrap();
379-
assert_migrated_correctly(migrated, output);
385+
assert_migrated_correctly(migrated.clone(), output);
386+
387+
// expect that rerunning the migration does not result in another migration
388+
if let Some(migrated) = migrated {
389+
let rerun = run_migrations(&migrated, migrations).unwrap();
390+
assert_migrated_correctly(rerun, None);
391+
}
380392
}
381393

382394
#[test]

0 commit comments

Comments
 (0)