mirror of
https://github.com/diesel-rs/diesel.git
synced 2024-10-04 09:39:24 +03:00
review feedback: if-let -> if and remove extraneous id column
This commit is contained in:
parent
0ffbed6274
commit
b499541349
@ -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.
|
||||
|
@ -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
|
||||
)",
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user