Skip to content

Commit a4014d1

Browse files
authored
Merge pull request #9933 from Turbo87/simple-harness
admin/migrate: Simplify `HarnessWithOutput` creation
2 parents 9d947eb + 5ad54e9 commit a4014d1

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/bin/crates-admin/migrate.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,10 @@ pub async fn run(_opts: Opts) -> Result<(), Error> {
4747

4848
spawn_blocking(move || {
4949
info!("Migrating the database");
50-
let mut stdout = std::io::stdout();
51-
let mut harness = HarnessWithOutput::new(&mut conn, &mut stdout);
52-
harness
50+
HarnessWithOutput::write_to_stdout(&mut conn)
5351
.run_pending_migrations(MIGRATIONS)
54-
.map_err(|err| anyhow!("Failed to run migrations: {err}"))?;
52+
.map_err(|e| anyhow!(e))
53+
.context("Failed to run migrations")?;
5554

5655
info!("Synchronizing crate categories");
5756
crates_io::boot::categories::sync_with_connection(CATEGORIES_TOML, &mut conn)?;

0 commit comments

Comments
 (0)