-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add a way to skip generating some sql type definitions #4002
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
41d6ca4
Add the skip missing sql_type definitions
Sagebati 79fd9e5
remove formatting
Sagebati 9e1c081
fmt
6f3b504
Add CHANGELOG.md
236bbeb
Add test
7081c43
Reanamed the command and tried to test it.
Sagebati b9b6d91
update CHANGELOG.md
Sagebati 6c2cbbb
fmt
Sagebati 722a134
remove dbg
Sagebati 48d4c14
typo in the CHANGELOG.md
Sagebati e2c3939
fmt clippy working tests
Sagebati 0b84d1d
hyphens instead of underscores
Sagebati a789a04
Add feature gate for the except custom type deifinition
Sagebati 2b41ae1
revert changelog
Sagebati 496e076
Update CHANGELOG.md
weiznich 1a7dabb
Another clippy fix after rebasing
weiznich File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
diesel_cli/tests/print_schema/print_schema_except_custom_type_definitions/diesel.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[print_schema] | ||
file = "src/schema.rs" | ||
except_custom_type_definitions = ["MyType2"] | ||
custom_type_derives = ["diesel::query_builder::QueryId", "Clone"] |
23 changes: 23 additions & 0 deletions
23
...cli/tests/print_schema/print_schema_except_custom_type_definitions/postgres/expected.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
source: diesel_cli/tests/print_schema.rs | ||
description: "Test: print_schema_except_custom_type_definitions" | ||
--- | ||
// @generated automatically by Diesel CLI. | ||
|
||
pub mod sql_types { | ||
#[derive(diesel::query_builder::QueryId, Clone, diesel::sql_types::SqlType)] | ||
#[diesel(postgres_type(name = "my_type"))] | ||
pub struct MyType; | ||
} | ||
|
||
diesel::table! { | ||
use diesel::sql_types::*; | ||
use super::sql_types::MyType; | ||
|
||
custom_types (id) { | ||
id -> Int4, | ||
custom_enum -> MyType, | ||
custom_enum_nullable -> Nullable<MyType>, | ||
custom_enum2 -> MyType2, | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
...el_cli/tests/print_schema/print_schema_except_custom_type_definitions/postgres/schema.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
CREATE TYPE my_type AS ENUM ('foo', 'bar'); | ||
CREATE TYPE my_type2 AS ENUM ('foo', 'bar'); | ||
CREATE TABLE custom_types ( | ||
id SERIAL PRIMARY KEY, | ||
custom_enum my_type NOT NULL, | ||
custom_enum_nullable my_type, | ||
custom_enum2 my_type2 NOT NULL | ||
); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is run for all backends but it only contains files for postgresql. That's the reason it is failing for SQLite. There are two options to fix this:
#[cfg(feature = "postgres")]
to the test function to mark this test as postgres only