I understand that rails db:migrate
only affects the development database.
When running rspec
with guard-rspec
and spring
, the test environment doesn't automatically apply migrations. Instead, you have to have guard
fail, manually run RAILS_ENV=test rails db:migrate
, and run your rspec guard again. This is expected behavior according to this issue: https://github.com/rails/rails/issues/25804
How could I make it so that either rails db:migrate
does so for both environment at once, or have spring rspec
automatically run pending migrations for the test environment as well?
I'd rather avoid a bash/zsh/shell alias because it has to be set up manually on everyone's machine.
正如@stuart在评论中所说,唯一的方法是RAILS_ENV=test rails db:migrate && RAILS_ENV=development rails db:migrate
或rails db:migrate db:test:prepare
。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.