Skip to content

Commit 1da15a6

Browse files
committed
Don't delete all categories
The opposite of `= ANY` is `!= ALL` /facepalm
1 parent 13bf9cd commit 1da15a6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/categories.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ struct NewCategory {
100100

101101
pub fn sync() -> CargoResult<()> {
102102
use diesel::pg::upsert::*;
103-
use diesel::expression::dsl::any;
103+
use diesel::expression::dsl::all;
104104

105105
let conn = db::connect_now().unwrap();
106106

@@ -136,7 +136,7 @@ pub fn sync() -> CargoResult<()> {
136136
.returning(categories::slug)
137137
.get_results::<String>(&conn)?;
138138

139-
let to_delete = categories::table.filter(categories::slug.ne(any(slugs)));
139+
let to_delete = categories::table.filter(categories::slug.ne(all(slugs)));
140140
diesel::delete(to_delete).execute(&conn)?;
141141
Ok(())
142142
})

0 commit comments

Comments
 (0)