2

Our database schema is generated programmatically from files in our /models directory. I'd like to figure out a git hook I can use so that when doing a checkout or merge, I compare the SHA1 of the /models directory, and if it is not the same as what I had before, I re-initialize the test database and reload our fixtures.

Is it possible to lookup the SHA1 of the /models directory, save it in a variable, and then compare it to the results after completing the checkout/merge?

Thanks in advance for any pointers.

4

1 回答 1

0

对于 Rails,guard-migrate是一个不错的解决方案,它在与 git 不同的级别上运行。它监视 db/schema.rb 的更改,然后在必要时更新数据库。请务必在编写迁移时将其关闭。

于 2014-09-29T01:47:08.247 回答