"rake db:seed"和"rake db:seed"之间有什么区别?并耙db:fixtures:load“ [英] What is the difference between "rake db:seed" and rake db:fixtures:load"

查看:80
本文介绍了"rake db:seed"和"rake db:seed"之间有什么区别?并耙db:fixtures:load“的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Ruby和Rails的新手,并对某些事情感到好奇.

在两个不同的教程中,我正在研究它们使用不同的方法用基本测试信息填充数据库.

使用"rake db:seed"从带有示例数据的文本文件中提取.

另一个使用"rake db:fixtures:load".

对我来说,他们似乎做的完全一样.

是他们,还是我在这里想念什么? (很有可能)

解决方案

此处.

rake db:fixtures:load 将测试装置加载到测试数据库中.这是仅由测试使用的临时数据.您可以将灯具视为样本数据.

I am new to Ruby and Rails and am curious about something.

In two different tutorials I am looking at they use different methods for populating a database with basic test information.

One uses "rake db:seed" to pull from a text file with sample data.

The other uses "rake db:fixtures:load".

To me they appear to do the exact same thing.

Do they, or am I missing something here? (Highly likely)

解决方案

rake db:seeds loads the data from db/seeds.rb into the database. This is generally used for development and production databases. It's permanent data that you use to start an empty application. More information here.

rake db:fixtures:load loads the test fixtures into the test database. This is temporary data used solely by the tests. You can think of fixtures as sample data.

这篇关于"rake db:seed"和"rake db:seed"之间有什么区别?并耙db:fixtures:load“的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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