Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Clone to the default value of custom_type_derives in diesel.toml #3888

Merged
merged 3 commits into from
Dec 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion diesel_cli/src/default_files/diesel.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

[print_schema]
file = "src/schema.rs"
custom_type_derives = ["diesel::query_builder::QueryId"]
custom_type_derives = ["diesel::query_builder::QueryId", "Clone"]

[migrations_directory]
dir = "migrations"
2 changes: 2 additions & 0 deletions diesel_cli/tests/print_schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,8 @@ fn print_schema_with_enum_set_types() {
"--with-docs",
"--custom-type-derives",
"diesel::query_builder::QueryId",
"--custom-type-derives",
"Clone",
],
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[print_schema]
file = "src/schema.rs"
with_docs = true
custom_type_derives = ["diesel::query_builder::QueryId"]
custom_type_derives = ["diesel::query_builder::QueryId", "Clone"]
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ pub mod sql_types {
/// The `my_type` SQL type
///
/// (Automatically generated by Diesel.)
#[derive(diesel::query_builder::QueryId, diesel::sql_types::SqlType)]
#[derive(diesel::query_builder::QueryId, Clone, diesel::sql_types::SqlType)]
#[diesel(postgres_type(name = "my_type"))]
pub struct MyType;

/// The `my_type2` SQL type
///
/// (Automatically generated by Diesel.)
#[derive(diesel::query_builder::QueryId, diesel::sql_types::SqlType)]
#[derive(diesel::query_builder::QueryId, Clone, diesel::sql_types::SqlType)]
#[diesel(postgres_type(name = "my_type2"))]
pub struct MyType2;
}
Expand Down Expand Up @@ -58,4 +58,3 @@ diesel::table! {
custom_enum2 -> MyType2,
}
}

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[print_schema]
file = "src/schema.rs"
with_docs = true
custom_type_derives = ["diesel::query_builder::QueryId"]
custom_type_derives = ["diesel::query_builder::QueryId", "Clone"]
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ pub mod sql_types {
/// The `my_type` SQL type
///
/// (Automatically generated by Diesel.)
#[derive(diesel::query_builder::QueryId, diesel::sql_types::SqlType)]
#[derive(diesel::query_builder::QueryId, Clone, diesel::sql_types::SqlType)]
#[diesel(postgres_type(name = "my_type"))]
pub struct MyType;

/// The `my_type2` SQL type
///
/// (Automatically generated by Diesel.)
#[derive(diesel::query_builder::QueryId, diesel::sql_types::SqlType)]
#[derive(diesel::query_builder::QueryId, Clone, diesel::sql_types::SqlType)]
#[diesel(postgres_type(name = "my_type2"))]
pub struct MyType2;
}
Expand Down Expand Up @@ -58,4 +58,3 @@ diesel::table! {
custom_enum2 -> MyType2,
}
}

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[print_schema]
file = "src/schema.rs"
with_docs = true
custom_type_derives = ["diesel::query_builder::QueryId"]
custom_type_derives = ["diesel::query_builder::QueryId", "Clone"]
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ pub mod sql_types {
/// The `MyType` SQL type
///
/// (Automatically generated by Diesel.)
#[derive(diesel::query_builder::QueryId, diesel::sql_types::SqlType)]
#[derive(diesel::query_builder::QueryId, Clone, diesel::sql_types::SqlType)]
#[diesel(postgres_type(name = "MyType"))]
pub struct MyType;

/// The `MyType2` SQL type
///
/// (Automatically generated by Diesel.)
#[derive(diesel::query_builder::QueryId, diesel::sql_types::SqlType)]
#[derive(diesel::query_builder::QueryId, Clone, diesel::sql_types::SqlType)]
#[diesel(postgres_type(name = "MyType2"))]
pub struct MyType2;
}
Expand Down Expand Up @@ -58,4 +58,3 @@ diesel::table! {
custom_enum2 -> MyType2,
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
file = "src/schema.rs"
with_docs = true
schema = "custom_schema"
custom_type_derives = ["diesel::query_builder::QueryId"]
custom_type_derives = ["diesel::query_builder::QueryId", "Clone"]
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub mod custom_schema {
/// The `custom_schema.my_enum` SQL type
///
/// (Automatically generated by Diesel.)
#[derive(diesel::query_builder::QueryId, diesel::sql_types::SqlType)]
#[derive(diesel::query_builder::QueryId, Clone, diesel::sql_types::SqlType)]
#[diesel(postgres_type(name = "my_enum", schema = "custom_schema"))]
pub struct MyEnum;
}
Expand Down Expand Up @@ -40,4 +40,3 @@ pub mod custom_schema {
}
}
}

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[print_schema]
file = "src/schema.rs"
with_docs = true
custom_type_derives = ["diesel::query_builder::QueryId"]
custom_type_derives = ["diesel::query_builder::QueryId", "Clone"]
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub mod sql_types {
/// The `user_job` SQL type
///
/// (Automatically generated by Diesel.)
#[derive(diesel::query_builder::QueryId, diesel::sql_types::SqlType)]
#[derive(diesel::query_builder::QueryId, Clone, diesel::sql_types::SqlType)]
#[diesel(postgres_type(name = "user_job"))]
pub struct UserJob;
}
Expand All @@ -38,4 +38,3 @@ diesel::table! {
job -> UserJob,
}
}

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[print_schema]
file = "src/schema.rs"
with_docs = true
custom_type_derives = ["diesel::query_builder::QueryId"]
custom_type_derives = ["diesel::query_builder::QueryId", "Clone"]
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ pub mod sql_types {
/// [`users1::enabled_features`](super::users1::enabled_features)) column
///
/// (Automatically generated by Diesel.)
#[derive(diesel::query_builder::QueryId, diesel::sql_types::SqlType)]
#[derive(diesel::query_builder::QueryId, Clone, diesel::sql_types::SqlType)]
#[diesel(mysql_type(name = "Set"))]
pub struct Users1EnabledFeaturesSet;

/// The `enum` SQL type for the
/// [`users1::user_state`](super::users1::user_state)) column
///
/// (Automatically generated by Diesel.)
#[derive(diesel::query_builder::QueryId, diesel::sql_types::SqlType)]
#[derive(diesel::query_builder::QueryId, Clone, diesel::sql_types::SqlType)]
#[diesel(mysql_type(name = "Enum"))]
pub struct Users1UserStateEnum;
}
Expand Down Expand Up @@ -56,4 +56,3 @@ diesel::table! {
enabled_features -> Users1EnabledFeaturesSet,
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ pub mod sql_types {
/// The `some_enum` SQL type
///
/// (Automatically generated by Diesel.)
#[derive(diesel::query_builder::QueryId, diesel::sql_types::SqlType)]
#[derive(diesel::query_builder::QueryId, Clone, diesel::sql_types::SqlType)]
#[diesel(postgres_type(name = "some_enum"))]
pub struct SomeEnum;

/// The `some_enum_2` SQL type
///
/// (Automatically generated by Diesel.)
#[derive(diesel::query_builder::QueryId, diesel::sql_types::SqlType)]
#[derive(diesel::query_builder::QueryId, Clone, diesel::sql_types::SqlType)]
#[diesel(postgres_type(name = "some_enum_2"))]
pub struct SomeEnum2;
}
Expand Down Expand Up @@ -52,4 +52,3 @@ diesel::table! {
some_field_2 -> SomeEnum2,
}
}

2 changes: 1 addition & 1 deletion examples/postgres/composite_types/diesel.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

[print_schema]
file = "src/schema.rs"
custom_type_derives = ["diesel::query_builder::QueryId"]
custom_type_derives = ["diesel::query_builder::QueryId", "Clone"]

[migrations_directory]
dir = "migrations"