Skip to content

Use the --locked-schema flag in Diesel 1.4 #1611

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

Merged
merged 1 commit into from
Feb 1, 2019

Conversation

sgrif
Copy link
Contributor

@sgrif sgrif commented Jan 28, 2019

This flag tells Diesel CLI to error if a command would change
src/schema.rs, rather than updating it. By running this in CI and
production builds, we ensure that no PR will pass which changes schema
but doesn't modify this file (which has happened in the past)

This flag tells Diesel CLI to error if a command would change
`src/schema.rs`, rather than updating it. By running this in CI and
production builds, we ensure that no PR will pass which changes schema
but doesn't modify this file (which has happened in the past)
@jtgeibel
Copy link
Member

jtgeibel commented Feb 1, 2019

@bors r+

@bors
Copy link
Contributor

bors commented Feb 1, 2019

📌 Commit 1cdb355 has been approved by jtgeibel

@bors
Copy link
Contributor

bors commented Feb 1, 2019

⌛ Testing commit 1cdb355 with merge 9fa7dee...

bors added a commit that referenced this pull request Feb 1, 2019
Use the `--locked-schema` flag in Diesel 1.4

This flag tells Diesel CLI to error if a command would change
`src/schema.rs`, rather than updating it. By running this in CI and
production builds, we ensure that no PR will pass which changes schema
but doesn't modify this file (which has happened in the past)
@bors
Copy link
Contributor

bors commented Feb 1, 2019

☀️ Test successful - checks-travis
Approved by: jtgeibel
Pushing 9fa7dee to master...

@bors bors merged commit 1cdb355 into rust-lang:master Feb 1, 2019
@jtgeibel
Copy link
Member

jtgeibel commented Feb 7, 2019

I'm seeing this error out on Heroku on staging, but running locally succeeds (as no changes to src/schema.rs are needed).

2019-02-07T08:47:12.503215+00:00 heroku[web.1]: Starting process with command `bin/diesel migration run --locked-schema && bin/start-nginx ./target/release/server`
2019-02-07T08:47:15.387093+00:00 app[web.1]: Command would result in changes to src/schema.rs. Rerun the command locally, and commit the changes.

@jtgeibel
Copy link
Member

jtgeibel commented Feb 7, 2019

I'm thinking the issue is that we run bin/diesel migration run --locked-schema at application boot, but the source code is not available at that time. The source is only available at build time. So at the point we run the migration command, no src/schema.rs exists and it will thus always differ.

@sgrif
Copy link
Contributor Author

sgrif commented Feb 7, 2019

Let's go ahead and revert for now then

@jtgeibel
Copy link
Member

jtgeibel commented Feb 7, 2019

I'm working on a PR to remove this from just from the Procfile, unless you think we should revert the whole PR.

jtgeibel added a commit to jtgeibel/crates.io that referenced this pull request Feb 7, 2019
This reverts a portion of rust-lang#1611.  Heroku does not make a checkout of
the source code available at runtime, so at the point in time we run
migrations `src/schema.rs` will not exist, and will thus always fail
this check.

The `--locked-schema` check is still run on CI, so this still gives us
confidence that our schema and `src/schema.rs` do not diverge.
@sgrif
Copy link
Contributor Author

sgrif commented Feb 7, 2019

No that's fine

bors added a commit that referenced this pull request Feb 7, 2019
Remove `--locked-schema` when running migrations on Heroku

This reverts a portion of #1611.  Heroku does not make a checkout of
the source code available at runtime, so at the point in time we run
migrations `src/schema.rs` will not exist, and will thus always fail
this check.

The `--locked-schema` check is still run on CI, so this still gives us
confidence that our schema and `src/schema.rs` do not diverge.
@sgrif sgrif deleted the sg-locked-schema branch March 9, 2019 01:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants