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

Cannot infer_schema! with Uuid type #810

Closed
Rukenshia opened this Issue Mar 18, 2017 · 1 comment

Comments

Projects
None yet
1 participant
@Rukenshia

Rukenshia commented Mar 18, 2017

Diesel version:

diesel = { version = "0.12.0", features = ["postgres"] }
diesel_codegen = { version = "0.12.0", features = ["postgres"] }

Rust: rustc 1.17.0-nightly (0aeb9c129 2017-03-15)

I have a User model with an UUID:

-- Your SQL goes here
CREATE TABLE users (
  id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
  email VARCHAR NOT NULL,
  password TEXT NOT NULL,
)

The infer_schema! macro fails everytime however:

infer_schema!("dotenv:DATABASE_URL");
error[E0412]: cannot find type `Uuid` in this scope
 --> dutrack-lib/src/db/schema.rs:3:1
  |
3 | infer_schema!("dotenv:DATABASE_URL");
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
  |
  = help: possible candidate is found in another module, you can import it into scope:
            `use uuid::Uuid;`
  = note: this error originates in a macro outside of the current crate

I tried importing Uuid into the scope in db/schema.rs but this didn't help either.

@Rukenshia

This comment has been minimized.

Rukenshia commented Mar 18, 2017

Nevermind, just saw that I need to add uuid to my features in the Cargo.toml.

@Rukenshia Rukenshia closed this Mar 18, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment