RailsでデータベースをMySQLからsqlite3に変更する。

http://garin.jp/doc/Ruby/Redmine/sqlite3tomysql

データベースをMySQLからsqlite3に変更する。

script/plugin install git://github.com/adamwiggins/yaml_db.git
rake db:dump RAILS_ENV=production

これで、db/data.ymlというファイルがダンプされる。
次に、sqlite3のデータベースを作成するが、
そのためにconfig/database.ymlを編集する。

# SQLite version 3.x
#   gem install sqlite3-ruby (not necessary on OS X Leopard)
development:
  adapter: sqlite3
  database: db/development.sqlite3
  pool: 5å
  timeout: 5000

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  adapter: sqlite3
  database: db/test.sqlite3
  pool: 5
  timeout: 5000

production:
  adapter: sqlite3
  database: db/production.sqlite3
  pool: 5
  timeout: 5000
rake db:create RAILS_ENV=development

でdb/development.sqlite3が作成される。

そんでもってさっきのdata.ymlをロードする。

rake db:load RAILS_ENV=development

yatta~~!!