NameError: uninitialized constant PG On Migrating to VPS

NameError: uninitialized constant PG On Migrating to VPS

我正在使用 Capistrano 3.0 将 Rails 应用程序部署到 VPS。当我 运行 cap production deploy 我最终遇到以下错误。我正在使用 Postgresql。

INFO [356ebea5] Running ~/.rvm/bin/rvm default do bundle exec rake db:migrate as deployer@ipaddress
DEBUG [356ebea5] Command: cd /home/deployer/scoutqatar/releases/20150315174921 && ( RAILS_ENV=production ~/.rvm/bin/rvm default do bundle exec rake db:migrate )
DEBUG [356ebea5]    rake aborted!
DEBUG [356ebea5]    NameError: uninitialized constant PG

我好像在迁移过程中出错了。

我在 VPS 中有 config/database.yml 文件,其中包含以下内容:

development:
  adapter: postgresql
  encoding: utf8
  database: dohaguide_development
  pool: 5
  username: user
  password: pass

test: &TEST
  adapter: postgresql
  encoding: utf8
  database: dohaguide_test
  pool: 5
  username: user
  password: pass

production:
  adapter: postgresql
  encoding: utf8
  database: dohaguide_production
  pool: 5
  username: user    
  password: pass

我已经在 VPS 中创建了上述数据库。

我的 deploy.rb 文件包含以下内容

# Default value for :linked_files is []
set :linked_files, %w{config/database.yml}

# Default value for linked_dirs is []
set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}

namespace :deploy do

  desc 'Restart application'
  task :restart do
    on roles(:app), in: :sequence, wait: 5 do
      # Your restart mechanism here, for example:
      execute :touch, release_path.join('tmp/restart.txt')
    end
  end

  after :publishing, :restart

  after :restart, :clear_cache do
    on roles(:web), in: :groups, limit: 3, wait: 10 do
      # Here we can do anything such as:
      # within release_path do
      #   execute :rake, 'cache:clear'
      # end
    end
  end

  after :finishing, 'deploy:cleanup'

end

我一直在试图找出错误的原因,但找不到任何错误。 有人可以指导我正确的方向吗

问题似乎是数据库用户名与为 VPS 部署创建的用户名不同。