Using diesel CLI with `exclude_custom_type_definitions` has unexpected outcomes
Swaagie opened this issue · comments
Setup
Versions
- Rust: 1.78
- Diesel: 2.2.0
- Database: Postgres
- Operating System: MacOS
Feature Flags
- diesel:
["postgres", "serde_json", "chrono", "uuid"]
Problem Description
What are you trying to accomplish?
Generating a schema that uses the Geometry SQL types from postgis-diesel. Using the feature exclude_custom_type_definitions
introduced with #4002 and documented with https://diesel.rs/guides/configuring-diesel-cli.html#the-exclude_custom_type_definitions-field.
What is the expected output?
No custom definition and an import of the postgis-diesel type(s).
What is the actual output?
The custom definition is created and rather than saving output to src/schema.rs
a new file is created with the name of the value of exclude_custom_type_definitions
.
Are you seeing any additional errors?
No additional errors. Patching the documentation or the CLI configuration to align would be great. Diesel CLI saving to a filename other than configured is also worthwhile fixing.
Steps to reproduce
Use a diesel.toml
configured as below. Then run diesel migration redo
.
[print_schema]
file = "src/schema.rs"
custom_type_derives = ["diesel::query_builder::QueryId"]
import_types = ["diesel::sql_types::*", "postgis_diesel::sql_types::*"]
exclude_custom_type_definitions = ["Geometry"]
To get the desired output except_custom_type_definitions
has to be used rather than exclude_custom_type_definitions
. This will properly save output to src/schema.rs
and will use the postgis-diesel type.
Checklist
- I have already looked over the issue tracker and the discussion forum for similar possible closed issues.
- This issue can be reproduced on Rust's stable channel. (Your issue will be
closed if this is not the case) - This issue can be reproduced without requiring a third party crate
Thanks for pointing out. That seems to be a bit of broken documentation. Mind submitting a PR that fixes the documentation here: https://github.com/sgrif/diesel.rs-website/blob/master/src/guides/configuring-diesel-cli.md?plain=1#L131 ?