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

Support: Unexpected null for non-null column in tutorial #670

Closed
Aaronepower opened this Issue Feb 10, 2017 · 5 comments

Comments

Projects
None yet
2 participants
@Aaronepower

Aaronepower commented Feb 10, 2017

I get "Unexpected null for non-null column" when running diesel migration redo after creating the migration scripts during the Getting Started tutorial.

@sgrif

This comment has been minimized.

Member

sgrif commented Feb 10, 2017

Can you be more specific? Can you give the output of diesel --version? Are you running against Postgres? Can you give the full error message you receive (and possibly run with RUST_BACKTRACE=1? Are the steps that you followed approximated by the following shell commands?

cargo install diesel_cli
diesel setup
diesel migration generate create_posts
echo "CREATE TABLE posts (...)" > migrations/xxx_create_posts/up.sql
echo "DROP TABLE posts;" > migrations/xxx_create_posts/down.sql
diesel migration run
diesel migration redo
@Aaronepower

This comment has been minimized.

Aaronepower commented Feb 10, 2017

@sgrif I did not run diesel migration run the guide doesn't say to?

@sgrif

This comment has been minimized.

Member

sgrif commented Feb 10, 2017

The guide does say to run diesel migration run.

We can apply our new migration with diesel migration run. It's a good idea to make sure that down.sql is correct. You can do a quick sanity check by doing diesel migration redo, which will revert and reapply the latest migration.

Still, you shouldn't get an error from omitting diesel migration run. I'll see if I can reproduce.

@Aaronepower

This comment has been minimized.

Aaronepower commented Feb 10, 2017

Ahh, I couldn't see the first command. With diesel migration run it works.

@sgrif

This comment has been minimized.

Member

sgrif commented Feb 10, 2017

I was able to reproduce the issue at least. It shouldn't error in this case. I'll open a separate issue to track.

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