You need to use dotenv before you use DATABASE_URL. From the tutorial you linked, they use it here:
fn establish_connection() -> PgConnection {
dotenv().ok();
let database_url = env::var("DATABASE_URL").expect("DATABASE_URL must be set");
PgConnection::establish(&database_url).expect(&format!("Error connecting to {}", database_url))
}
I see that the tutorial does that later.
For now I can do diesel setup --database_url = "postgres://localhost/rust_graphql_example"
as the error message says.
Can the problem not be that Diesel is not working fine with Windows ?
diesel migration run --database-url "postgres://localhost/rust_graphql_example"
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ConnectionError(BadConnection("fe_sendauth: no password supplied\n"))', C:\Users\rwobb\.cargo\registry\src\github.com-1ecc6299db9ec823\diesel_cli-1.4.1\src/main.rs:83:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
I checked but the database is not made.
So I think this tutorial is or forgetting to mention things or assume that you know how to set up a database with diesel.
Your error message indicates that the provided credentials for postgres are not valid. Please recheck the configuration of your database server.
So I think this tutorial is or forgetting to mention things or assume that you know how to set up a database with diesel.
That's not specific to diesel, but part of the general setup of a database server. If you haven't done something like this before maybe check the corresponding guides provided by postgresql.
Also this is definitively nothing that should be covered by the guides provided by diesel as this touches the database itself. The configuration there is highly depended on your specific environment, so diesel would not be able to cover all possible variants.
If you follow this argumentation down to the bottom where would you stop mentioning setup related stuff? Should the guide include a part describing how to setup your operating system? Or even how to assemble your own PC? I mean if you want to use postgres (which is not the only choice while using diesel) you need to setup postgres in a meaningful way. I think it should be obvious that the postgres docs are a more appropriated location for documentation related to that topic than the diesel documentation.
I think you misunderstood. I was trying to say that postgres' setup process isn't very straightforward so they can't just include it in the tutorial. I was agreeing with you.