Skip to content
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

Suggest 'rake build' or 'rake db:migrate' when schema.rb is changed #13711

Merged
merged 1 commit into from Mar 10, 2017

Conversation

davidsbailey
Copy link
Member

Today when we pull staging we get friendly reminders to run e.g. yarn or bundle install when necessary but not rake db:migrate. This PR adds a reminder to run rake db:migrate when schema.rb has changed.

Caveats

  • someone might forget to commit changes to the schema, in which case we won't show a warning. this seems mostly harmless and is only as bad as it was before.
  • we might someday have another file called schema.rb. but probably not.

Sample output

To test this I made a change to schema.rb from another git client, pushed it to origin, and then pulled it down to the original git client. Here is the output:

Davids-MacBook-Pro-2:~/src/cdo2 (suggest-db-migrate)$ git pull origin suggest-db-migrate 
From https://github.com/code-dot-org/code-dot-org
 * branch            suggest-db-migrate -> FETCH_HEAD
Updating 3806f63..693f564
Fast-forward
 dashboard/db/schema.rb | 16 ----------------
 1 file changed, 16 deletions(-)
dashboard/db/schema.rb changed; you probably want to run rake db:migrate or rake build

Copy link
Contributor

@aoby aoby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@@ -7,7 +7,8 @@
"package.json" => "yarn",
"bower.json" => "bower install",
"Gemfile" => "bundle install",
"Berksfile" => "berks install"
"Berksfile" => "berks install",
"schema.rb" => "rake db:migrate"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do these "file patterns" accept paths? We could do "dashboard/db/schema.rb" just in case we ever get another schema.rb like you suggested.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently these "file patterns" do not accept paths. They do an exact comparison to the result of File.basename. I don't want to risk breaking the rest of what's already working in this file so I think we should punt on that until we need it.

@davidsbailey davidsbailey merged commit 413ebb8 into staging Mar 10, 2017
@davidsbailey davidsbailey deleted the suggest-db-migrate branch March 10, 2017 00:41
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.

None yet

2 participants