Ruby on rails 如何理解;rake db:seed";

Ruby on rails 如何理解;rake db:seed";,ruby-on-rails,database,seed,dbmigrate,Ruby On Rails,Database,Seed,Dbmigrate,我正在使用Michael Hartl的rails教程。 每当我使用下面的 $ bundle exec rake db:migrate:reset 然后 它等待着。它没有显示任何东西 当我这样做的时候: bundle exec rake test 我明白了 ActiveRecord::PendingMigrationError: Migrations are pending. To resolve this issue, bin/rake db:migrate RAILS_ENV=test

我正在使用Michael Hartl的rails教程。 每当我使用下面的

$ bundle exec rake db:migrate:reset 
然后

它等待着。它没有显示任何东西

当我这样做的时候:

bundle exec rake test
我明白了

ActiveRecord::PendingMigrationError: Migrations are pending.
To resolve this issue, 
bin/rake db:migrate RAILS_ENV=test
完成上述操作后——“db:migrate RAILS_ENV=test”,测试将被清除


但是Michael没有提到这个场景发生的任何事情,有人能帮忙解释一下吗?

默认情况下,大多数
rake
命令将在传递给命令行的
RAILS\u ENV
上下文中运行。如果没有
RAILS\u ENV
传递到命令行,它将在
development
上下文中运行,该上下文与
test
上下文分离。有一些例外,比如
rake db:create
,它将创建
开发
测试
数据库,但是
迁移
将在指定的环境下工作。

你的意思是,除非明确迁移,否则我不会在测试环境中拥有数据库?你的数据库将在那里,但是迁移——定义所有表和列等的东西——将不存在。
ActiveRecord::PendingMigrationError: Migrations are pending.
To resolve this issue, 
bin/rake db:migrate RAILS_ENV=test