What does rake db:test:prepare actually do?

后端 未结 3 1078
野趣味
野趣味 2020-12-02 07:07

I am following the rails tutorial videos and I can\'t figure out what the db:test:prepare command actually does. Can someone provide an explanation?

3条回答
  •  -上瘾入骨i
    2020-12-02 07:53

    The rake db:migrate above runs any pending migrations on the development environment and updates db/schema.rb. The rake db:test:load recreates the test database from the current db/schema.rb. On subsequent attempts, it is a good idea to first run db:test:prepare, as it first checks for pending migrations and warns you appropriately.

    -- http://guides.rubyonrails.org/testing.html

    Basically it handles cloning the database so you don't have to run the migrations against test to update the test database.

提交回复
热议问题