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

Using diesel CLI with exclude_custom_type_definitions has unexpected outcomes #4055

Closed
3 tasks done
Swaagie opened this issue Jun 1, 2024 · 1 comment · Fixed by #4057
Closed
3 tasks done

Using diesel CLI with exclude_custom_type_definitions has unexpected outcomes #4055

Swaagie opened this issue Jun 1, 2024 · 1 comment · Fixed by #4057
Labels

Comments

@Swaagie
Copy link

Swaagie commented Jun 1, 2024

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

  • 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
@Swaagie Swaagie added the bug label Jun 1, 2024
@Swaagie Swaagie changed the title Using diesel CLI Using diesel CLI with exclude_custom_type_definitions has unexpected outcomes Jun 1, 2024
@weiznich
Copy link
Member

weiznich commented Jun 1, 2024

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 ?

weiznich added a commit to weiznich/diesel that referenced this issue Jun 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants