rake db:test:prepare 实际上做了什么? [英] What does rake db:test:prepare actually do?

查看:42
本文介绍了rake db:test:prepare 实际上做了什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在关注 rails 教程视频,但我无法弄清楚 db:test:prepare 命令实际上做了什么.有人可以提供解释吗?

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?

推荐答案

上面的 rake db:migrate 在开发环境和更新 db/schema.rb.耙子db:test:load 从当前数据库重新创建测试数据库db/schema.rb.在随后的尝试中,最好先运行db:test:prepare,因为它首先检查挂起的迁移并发出警告你适当地.

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.

这篇关于rake db:test:prepare 实际上做了什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆