I am struggling to find a way to update a column. This column has a composite primary key.
I've tried something like:
for anime_ranking in new_anime_rankings {
let mut db_anime_ranking: models::AnimeRanking = anime_rankings
.find((anime_ranking.id, anime_ranking.genre_combo_id))
.first(&mut connection)?;
println!("{}", db_anime_ranking.id);
db_anime_ranking.times_watched += 1; // directly increment it by 1 as anime_ranking.times_watched is always 1
update(anime_rankings.filter((id.eq(anime_ranking.id), genre_combo_id.eq(anime_ranking.genre_combo_id))))
.set(times_watched.eq(db_anime_ranking.times_watched += 1))
.execute(&mut connection)?;
}
Though it does not work. I can't find anything about it in the docs as well. Please help me.
Found it. You have to use .and():