Rails 3.1在本地迁移到PostgreSQL

时间:2012-03-07 16:29:42

标签: mysql ruby-on-rails-3 postgresql

我想在本地使用PostgreSQL,因为我必须在Heroku上使用它。我已经构建了我的应用程序,所以我现在需要转换使用MySQL的内容。

我有

group :development, :test do
  gem 'pg'
end
group :production do
  gem 'pg'
end

我已经brew install pg了。我跑了rake db:setup并收到此错误

Couldn't create database for {"adapter"=>"sqlite3", "database"=>"db/test.sqlite3", "pool"=>5, "timeout"=>5000}
db/development.sqlite3 already exists
rake aborted!
Please install the sqlite3 adapter: `gem install activerecord-sqlite3-adapter` (sqlite3 is not part of the bundle. Add it to Gemfile.)

怎么了?

1 个答案:

答案 0 :(得分:0)

您是否更新了database.yml文件以使用pg适配器?

development:
    adapter: postgresql
    database: cookbook
    username: uid
    password: pwd
    host: localhost

看起来你的database.yml仍然配置为使用SQLite。