Search code examples
ruby-on-railsdatabaseyamldump

yaml_db Not Working When Dumping the Database


I'm trying to convert my rubyonrails project from sqlite3 to MySQL by following:

Here is the command line log:

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$ 

and my OS info:

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

Solution

  • I finally figured out why. The installation requires two steps:

    Step 1. Install the gem yaml_db:

    gem install yaml_db

    Step 2. Add it to the Gemfile under your project home director

    gem 'yaml_db'

    Then we can run rake db:dump without any problems.