jish / pre-commit

A slightly improved pre-commit hook for git
https://jish.github.io/pre-commit/
Other
796 stars 96 forks source link

Rails schema.rb hook #143

Closed ngan closed 10 years ago

ngan commented 10 years ago

Would be great to detect an addition/modification of files db/migration/* and a non-stashed schema.rb file that has been changed and ask the user to confirm if they wish to commit.

jish commented 10 years ago

We have a check called the migration check. That check is enabled by defualt when you install the pre-commit gem. The migration check will look for instances where the migration directory was modified, but the schema was not updated as well:

https://github.com/jish/pre-commit/blob/83ff5c6f4ab48a3e9d5256f72aa227de2d069db9/lib/plugins/pre_commit/checks/migration.rb#L14-15

If pre-commit halts a check for any reason, you can always bypass running checks using git commit -n. So, even if you have a migration error, you can still commit.


I'm going to close this issue, but if you feel that your question has not been answered properly, please feel free to reply and re-open the issue. ;)

ngan commented 10 years ago

Perfect!