Trying to add back in the on_conflict_do_nothing.

This commit is contained in:
Dessalines 2020-08-31 07:41:15 -05:00
parent 31b0213cf3
commit 81b204c1b8
2 changed files with 2 additions and 9 deletions

View file

@ -61,9 +61,6 @@ impl Crud<CommentForm> for Comment {
}
fn create(conn: &PgConnection, comment_form: &CommentForm) -> Result<Self, Error> {
if let Some(for_ap_id) = &comment_form.ap_id {
println!("creating {}", for_ap_id);
}
use crate::schema::comment::dsl::*;
insert_into(comment)
.values(comment_form)
@ -169,9 +166,7 @@ impl Comment {
use crate::schema::comment::dsl::*;
insert_into(comment)
.values(comment_form)
.on_conflict(ap_id)
.do_update()
.set(comment_form)
.on_conflict_do_nothing()
.get_result::<Self>(conn)
}
}

View file

@ -183,9 +183,7 @@ impl Post {
use crate::schema::post::dsl::*;
insert_into(post)
.values(post_form)
.on_conflict(ap_id)
.do_update()
.set(post_form)
.on_conflict_do_nothing()
.get_result::<Self>(conn)
}
}