diff --git a/ch_07/src/store.rs b/ch_07/src/store.rs index 9aeb140..62ca416 100644 --- a/ch_07/src/store.rs +++ b/ch_07/src/store.rs @@ -136,14 +136,14 @@ impl Store { new_answer: NewAnswer, ) -> Result { match sqlx::query( - "INSERT INTO answers (content, question_id) VALUES ($1, $2)", + "INSERT INTO answers (content, corresponding_question) VALUES ($1, $2) RETURNING id, content, corresponding_question", ) .bind(new_answer.content) .bind(new_answer.question_id.0) .map(|row: PgRow| Answer { id: AnswerId(row.get("id")), content: row.get("content"), - question_id: QuestionId(row.get("question_id")), + question_id: QuestionId(row.get("corresponding_question")), }) .fetch_one(&self.connection) .await