7
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Ruby on RailsでテストDBと開発環境DBに差分がある際に実行すべきコマンド

Posted at

はじめに

migraterollbackの繰り返し等で開発環境のDBとテストDBに差分ができて、RSpecでテストを実行してエラーが起きた際に実行すべきコマンドを紹介します。

Rails4系の場合

rake db:environment:set RAILS_ENV=test
rake db:migrate:reset RAILS_ENV=test

###Rails5系の場合

rails db:environment:set RAILS_ENV=test
rails db:migrate:reset RAILS_ENV=test
7
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?