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

diesel.toml and schema.rs not created/generated #1726

Closed
hanckmann opened this Issue May 23, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@hanckmann

hanckmann commented May 23, 2018

When following the tutorial (http://diesel.rs/guides/getting-started/) it is stated that the diesel.toml and the schema.rs are automatically generated.
From the documentation it seems that the schema.rs should be updated every time a diesel migration is executed. The diesel.toml should be generated after executing diesel setup.

When following the tutorial (copy-pasting the command, but changing it into sqlite), these two files are not created/generated.

I realise that there are some issues using rust nightly with diesel. Therefore I reverted nightly to an older version (see below). If diesel is also broken for that nightly version, it would be great if you can point me to a version in which diesel works correctly. Note that my aim is to integrate this in a rocket webservice. Therefore I am on nightly.

Setup

The tutorial is followed by copy-pasting, but with the following changes:

  • Cargo.toml
    -- diesel = { version = "1.0.0", features = ["postgres"] }
    ++diesel = { version = "1.0.0", features = ["sqlite"] }
  • .env
    echo DATABASE_URL=/tmp/test_examples_2.sqlite > .env
  • migrations/2018-05-23-181147_create_posts/up.sql
    -- id SERIAL PRIMARY KEY,
    ++ id INTEGER PRIMARY KEY,
  • src/lib.rs
    -- use diesel::pg::PgConnection;
    ++ use diesel::pg::PgConnection;
    -- pub fn establish_connection() -> PgConnection {
    ++ pub fn establish_connection() -> SqliteConnection {
    -- PgConnection::establish(&database_url)
    ++ pub fn establish_connection() -> PgConnection {

Versions

  • Rust: rustc 1.27.0-nightly (9fae15374 2018-05-13)
  • Diesel: 1.0.0 is set by the Cargo.toml, however diesel --version returns: diesel 1.2.0 (?!?)
  • Database: sqlite
  • Operating System ArchLinux (last update 23/05/2018)

Feature Flags

  • diesel: sqlite

Problem Description

When running cargo run --bin show_posts right after the tutorial shows the content of the file: src/bin/show_posts.rs
The following error appears:
λ /tmp/diesel_demo3/ master* cargo run --bin show_posts Updating registry https://github.com/rust-lang/crates.io-index`
Compiling unicode-xid v0.1.0
Compiling libc v0.2.41
Compiling void v1.0.2
Compiling pkg-config v0.3.11
Compiling ucd-util v0.1.1
Compiling lazy_static v1.0.0
Compiling regex v0.2.11
Compiling utf8-ranges v1.0.0
Compiling byteorder v1.2.3
Compiling unreachable v1.0.0
Compiling proc-macro2 v0.3.8
Compiling regex-syntax v0.5.6
Compiling memchr v2.0.1
Compiling thread_local v0.3.5
Compiling libsqlite3-sys v0.9.1
Compiling aho-corasick v0.6.4
Compiling quote v0.5.2
Compiling syn v0.13.11
Compiling dotenv v0.9.0
Compiling diesel_derives v1.3.0
Compiling diesel v1.3.0
Compiling diesel_demo3 v0.1.0 (file:///tmp/diesel_demo3)
error[E0583]: file not found for module schema
--> src/lib.rs:5:9
|
5 | pub mod schema;
| ^^^^^^
|
= help: name the file either schema.rs or schema/mod.rs inside the directory "src"

error: aborting due to previous error

For more information about this error, try rustc --explain E0583.
error: Could not compile diesel_demo3.

To learn more, run the command again with --verbose.
`

What are you trying to accomplish?

To get this to work :-)

What is the expected output?

What is the actual output?

Are you seeing any additional errors?

No additional errors

Steps to reproduce

I think I added all changes iof the tutorial code in my descriptions above. It is no issue to send you the actual code if required.

Checklist

  • [V ] I have already looked over the issue tracker for similar issues.
  • [? ] This issue can be reproduced on Rust's stable channel.
@sgrif

This comment has been minimized.

Member

sgrif commented May 23, 2018

This is a new feature in Diesel 1.3. Please install the latest version of Diesel by running cargo install diesel_cli --force.

@sgrif sgrif closed this May 23, 2018

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