review feedback: if-let -> if and remove extraneous id column

This commit is contained in:
kirk 2023-12-01 10:26:08 -06:00
parent 0ffbed6274
commit b499541349
3 changed files with 3 additions and 6 deletions

View File

@ -46,7 +46,7 @@ fn derive_into_single_table(
for field in model.fields() {
// skip this field while generating the insertion
if let true = field.skip_insertion() {
if field.skip_insertion() {
continue;
}
// Use field-level attr. with fallback to the struct-level one.

View File

@ -458,7 +458,6 @@ fn insert_with_generated_column() {
use crate::schema::user_with_last_names::table as users;
#[derive(Debug, Queryable, Insertable, Selectable, Default)]
struct UserWithLastName {
id: i32,
first_name: String,
last_name: String,
#[diesel(skip_insertion)]
@ -468,8 +467,7 @@ fn insert_with_generated_column() {
let connection = &mut connection();
diesel::sql_query(
"CREATE TABLE user_with_last_names (
id SERIAL PRIMARY KEY,
first_name VARCHAR NOT NULL,
first_name VARCHAR NOT NULL PRIMARY KEY,
last_name VARCHAR NOT NULL,
full_NAME VARCHAR GENERATED ALWAYS AS (first_name || ' ' || last_name) STORED
)",

View File

@ -176,8 +176,7 @@ table! {
}
table! {
user_with_last_names (id) {
id -> Int4,
user_with_last_names (first_name) {
first_name -> Varchar,
last_name -> Varchar,
full_name -> Varchar,