转储数据库时yaml_db不起作用

时间:2012-06-19 16:31:12

标签: ruby-on-rails database yaml dump

我正在尝试通过以下方式将我的rubyonrails项目从sqlite3转换为MySQL:

这是命令行日志:

plee@sos:~/rubyonrails/blog$ gem install yaml_db
Successfully installed yaml_db-0.2.3
1 gem installed
Installing ri documentation for yaml_db-0.2.3...
Installing RDoc documentation for yaml_db-0.2.3...

plee@sos:~/rubyonrails/blog$ gem list | grep yaml_db
yaml_db (0.2.3)

plee@sos:~/rubyonrails/blog$ rake db:data:dump
rake aborted!
Don't know how to build task 'db:data:dump'

(See full trace by running task with --trace)

plee@sos:~/rubyonrails/blog$ rake db:dump
rake aborted!
Don't know how to build task 'db:dump'

(See full trace by running task with --trace)
plee@sos:~/rubyonrails/blog$ 

和我的操作系统信息:

plee@sos:~/rubyonrails/blog$ uname -a
Linux sos 2.6.38-15-generic-pae #60-Ubuntu SMP Tue May 22 11:48:17 UTC 2012 i686 i686 i386 GNU/Linux
plee@sos:~/rubyonrails/blog$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 11.04
Release:    11.04
Codename:   natty

1 个答案:

答案 0 :(得分:8)

我终于找到了原因。安装需要两个步骤:

步骤1.安装gem yaml_db

gem install yaml_db

步骤2.将其添加到项目主管

下的Gemfile

gem 'yaml_db'

然后我们可以毫无问题地运行rake db:dump