重置数据库(清除所有),然后种子数据库 [英] Reset the database (purge all), then seed a database

查看:266
本文介绍了重置数据库(清除所有),然后种子数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有rake命令清除数据库表中的数据?

Is there a rake command to wipe out the data in the database tables?

如何创建一个db:seed脚本来预填充数据到我的表? 我使用 rake db:reset ,然后删除,然后重新创建

How do I create a db:seed script to pre-fill data to my tables?

推荐答案

数据库并包括您的seeds.rb文件。
http://guides.rubyonrails.org/migrations.html#resetting - 数据库

I use rake db:reset which drops and then recreates the database and includes your seeds.rb file. http://guides.rubyonrails.org/migrations.html#resetting-the-database

这篇关于重置数据库(清除所有),然后种子数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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