Reputation: 100
I am using Michael Hartl's rails tutorials. Whenever I use the following
$ bundle exec rake db:migrate:reset
Then
$ bundle exec rake db:seed
It waits. It doesn't show anything.
And when I do:
bundle exec rake test
I get
ActiveRecord::PendingMigrationError: Migrations are pending.
To resolve this issue,
bin/rake db:migrate RAILS_ENV=test
When the above is done-"db:migrate RAILS_ENV=test", tests are clear.
However Michael doesn't mention anything happening about this scenario, Can anybody help and explain?
Upvotes: 1
Views: 2212
Reputation: 15056
By default, most rake
commands are going to run in the context of the RAILS_ENV
passed to the command line. If no RAILS_ENV
is passed to the command line, it will run in the development
context, which is separate from the test
context. There are a few exceptions, like rake db:create
, which will create your development
and test
databases, but migrate
will work against the specified environment.
Upvotes: 1