style: rustfmt the blob-removal code (fix the CI fmt gate)
The blob-removal commit (6b4c4dc) failed CI's fmt gate — long assert! lines
and a doc comment that stock rustfmt wraps. No behaviour change; just
`cargo fmt`. Verified via `nix develop -c cargo fmt --check`.
This commit is contained in:
@@ -394,8 +394,7 @@ mod tests {
|
|||||||
" - \"note <> 'type: blob'\"\n",
|
" - \"note <> 'type: blob'\"\n",
|
||||||
"relationships: []\n",
|
"relationships: []\n",
|
||||||
);
|
);
|
||||||
let outcome =
|
let outcome = migrate_to_latest(body, &MigratorRegistry::production(), tmp.path()).unwrap();
|
||||||
migrate_to_latest(body, &MigratorRegistry::production(), tmp.path()).unwrap();
|
|
||||||
assert_eq!(outcome.migrated_from, Some(1));
|
assert_eq!(outcome.migrated_from, Some(1));
|
||||||
assert!(outcome.body.contains("version: 2"));
|
assert!(outcome.body.contains("version: 2"));
|
||||||
// The blob column became text.
|
// The blob column became text.
|
||||||
|
|||||||
+2
-1
@@ -180,7 +180,8 @@ pub async fn run(args: Args) -> Result<()> {
|
|||||||
// force a `.db` rebuild after the v1→v2 migration converts it to text
|
// force a `.db` rebuild after the v1→v2 migration converts it to text
|
||||||
// (the stale `.db` keeps a `STRICT … BLOB` engine column + `"blob"`
|
// (the stale `.db` keeps a `STRICT … BLOB` engine column + `"blob"`
|
||||||
// metadata that load otherwise uses as-is).
|
// metadata that load otherwise uses as-is).
|
||||||
let had_blob_column = std::fs::read_to_string(project.path().join(crate::project::PROJECT_YAML))
|
let had_blob_column =
|
||||||
|
std::fs::read_to_string(project.path().join(crate::project::PROJECT_YAML))
|
||||||
.map(|b| crate::persistence::migrations::body_declares_blob_column(&b))
|
.map(|b| crate::persistence::migrations::body_declares_blob_column(&b))
|
||||||
.unwrap_or(false);
|
.unwrap_or(false);
|
||||||
let migrate_registry = crate::persistence::migrations::MigratorRegistry::production();
|
let migrate_registry = crate::persistence::migrations::MigratorRegistry::production();
|
||||||
|
|||||||
+5
-1
@@ -437,7 +437,11 @@ fn opens_a_legacy_v1_blob_project_by_migrating_to_text() {
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
.expect("write project.yaml");
|
.expect("write project.yaml");
|
||||||
fs::write(proj.join("data").join("Files.csv"), "id,payload\n1,aGVsbG8=\n").expect("write csv");
|
fs::write(
|
||||||
|
proj.join("data").join("Files.csv"),
|
||||||
|
"id,payload\n1,aGVsbG8=\n",
|
||||||
|
)
|
||||||
|
.expect("write csv");
|
||||||
fs::write(root.join("last_project"), format!("{}\n", proj.display())).expect("write resume");
|
fs::write(root.join("last_project"), format!("{}\n", proj.display())).expect("write resume");
|
||||||
|
|
||||||
// Open via --resume: the runtime migrates blob→text and rebuilds, so
|
// Open via --resume: the runtime migrates blob→text and rebuilds, so
|
||||||
|
|||||||
@@ -55,15 +55,24 @@ fn v1_blob_project_migrates_to_text_and_rebuilds() {
|
|||||||
assert_eq!(outcome.migrated_from, Some(1), "v1 project was migrated");
|
assert_eq!(outcome.migrated_from, Some(1), "v1 project was migrated");
|
||||||
|
|
||||||
let migrated = fs::read_to_string(root.join("project.yaml")).expect("read migrated");
|
let migrated = fs::read_to_string(root.join("project.yaml")).expect("read migrated");
|
||||||
assert!(migrated.contains("version: 2"), "version bumped: {migrated}");
|
assert!(
|
||||||
|
migrated.contains("version: 2"),
|
||||||
|
"version bumped: {migrated}"
|
||||||
|
);
|
||||||
assert!(
|
assert!(
|
||||||
migrated.contains("{ name: data, type: text }"),
|
migrated.contains("{ name: data, type: text }"),
|
||||||
"blob column rewritten to text: {migrated}"
|
"blob column rewritten to text: {migrated}"
|
||||||
);
|
);
|
||||||
assert!(!migrated.contains("type: blob"), "no blob type remains: {migrated}");
|
assert!(
|
||||||
|
!migrated.contains("type: blob"),
|
||||||
|
"no blob type remains: {migrated}"
|
||||||
|
);
|
||||||
// The pre-migration original is preserved as a .bak.
|
// The pre-migration original is preserved as a .bak.
|
||||||
let bak = fs::read_to_string(root.join("project.yaml.v1.bak")).expect("read bak");
|
let bak = fs::read_to_string(root.join("project.yaml.v1.bak")).expect("read bak");
|
||||||
assert!(bak.contains("type: blob"), "bak keeps the original blob column");
|
assert!(
|
||||||
|
bak.contains("type: blob"),
|
||||||
|
"bak keeps the original blob column"
|
||||||
|
);
|
||||||
|
|
||||||
// 2. Rebuild from the migrated text (as the runtime forces when a blob
|
// 2. Rebuild from the migrated text (as the runtime forces when a blob
|
||||||
// column was converted): the column is now `text` and the row data
|
// column was converted): the column is now `text` and the row data
|
||||||
|
|||||||
Reference in New Issue
Block a user