Skip to content

Commit 1e39dde

Browse files
Fix #645 and fix SQL query
1 parent ce47e8c commit 1e39dde

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/bin/transfer-crates.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ fn transfer(tx: &postgres::transaction::Transaction) {
5252
println!("====================================================");
5353
println!("WARNING");
5454
println!("");
55-
println!("this may not be the same github user, different avatar urls");
55+
println!("this may not be the same github user, different github IDs");
5656
println!("");
57-
println!("from: {:?}", from.gh_avatar);
58-
println!("to: {:?}", to.gh_avatar);
57+
println!("from: {:?}", from.gh_id);
58+
println!("to: {:?}", to.gh_id);
5959

6060
get_confirm("continue?");
6161
}
@@ -75,7 +75,7 @@ fn transfer(tx: &postgres::transaction::Transaction) {
7575
).unwrap();
7676
let rows = stmt.query(&[&from.id, &(OwnerKind::User as i32)]).unwrap();
7777
for row in rows.iter() {
78-
let id: i32 = row.get("id");
78+
let owner_id: i32 = row.get("owner_id");
7979
let krate = Crate::find(tx, row.get("crate_id")).unwrap();
8080
println!("transferring {}", krate.name);
8181
let owners = krate.owners_old(tx).unwrap();
@@ -84,8 +84,8 @@ fn transfer(tx: &postgres::transaction::Transaction) {
8484
}
8585
let n = tx.execute(
8686
"UPDATE crate_owners SET owner_id = $1
87-
WHERE id $2",
88-
&[&to.id, &id],
87+
WHERE owner_id = $2",
88+
&[&to.id, &owner_id],
8989
).unwrap();
9090
assert_eq!(n, 1);
9191
}

0 commit comments

Comments
 (0)