title: Capistrano 3 rails deploy cant find database
body: <p>DigitalOcean Ubuntu 14.04 x64 + Rails 4 + Nginx + Unicorn + PostgreSQL + Capistrano 3</p>
  
  <p>I used this walkthrough to deploy my digital ocean rails app. </p>
  
  <p><a href="https://gist.github.com/ChuckJHardy/f44dda5f94c6bbdba9a4" rel="nofollow">https://gist.github.com/ChuckJHardy/f44dda5f94c6bbdba9a4</a></p>
  
  <p>The instructions are very clear and too the point so I did not have to deviate from the walkthrough.</p>
  
  <p>I have finished everything and when i run</p>
  
  <pre><code>cap production deploy:check
  </code></pre>
  
  <p>there are no errors. But when I run</p>
  
  <pre><code>cap production deploy
  </code></pre>
  
  <p>It crashes saying </p>
  
  <pre><code>INFO [deploy:migrate] Checking changes in /db/migrate
  DEBUG [87821ebd] Running /usr/bin/env diff -q /home/deployer/apps/jones_jems/releases/20150506224711/db/migrate /home/deployer/apps/jones_jems/current/db/migrate as deployer@107.170.222.154
  DEBUG [87821ebd] Command: diff -q /home/deployer/apps/jones_jems/releases/20150506224711/db/migrate /home/deployer/apps/jones_jems/current/db/migrate
  DEBUG [87821ebd]    diff: 
  DEBUG [87821ebd]    /home/deployer/apps/jones_jems/current/db/migrate
  DEBUG [87821ebd]    : No such file or directory
  DEBUG [87821ebd]    
  DEBUG [87821ebd] Finished in 0.085 seconds with exit status 2 (failed).
  INFO [deploy:migrate] Run `rake db:migrate`
  DEBUG [b41648f9] Running /usr/bin/env if test ! -d /home/deployer/apps/jones_jems/releases/20150506224711; then echo "Directory does not exist '/home/deployer/apps/jones_jems/releases/20150506224711'" 1&gt;&amp;2; false; fi as deployer@107.170.222.154
  DEBUG [b41648f9] Command: if test ! -d /home/deployer/apps/jones_jems/releases/20150506224711; then echo "Directory does not exist '/home/deployer/apps/jones_jems/releases/20150506224711'" 1&gt;&amp;2; false; fi
  DEBUG [b41648f9] Finished in 0.074 seconds with exit status 0 (successful).
  INFO [bde04a76] Running ~/.rvm/bin/rvm default do bundle exec rake db:migrate as deployer@107.170.222.154
  DEBUG [bde04a76] Command: cd /home/deployer/apps/jones_jems/releases/20150506224711 &amp;&amp; ( RAILS_ENV=production ~/.rvm/bin/rvm default do bundle exec rake db:migrate )
  DEBUG [bde04a76]    rake aborted!
  DEBUG [bde04a76]    ActiveRecord::NoDatabaseError: FATAL:  database "JonesJems" does not exist
  </code></pre>
  
  <p>I followed the walkthrough on creating the database listed below</p>
  
  <p><strong>Create Postgres User</strong></p>
  
  <pre><code>sudo -u postgres psql
  create user deployer with password 'password';
  alter role deployer superuser createrole createdb replication;
  create database JonesJems owner deployer;
  </code></pre>
  
  <p>If i try to do this walkthrough again it says the says the database already exists.</p>
  
  <pre><code>postgres=# create database JonesJems owner deployer;
  ERROR:  database "jonesjems" already exists
  </code></pre>
  
  <p>Here is my rails database.yml file</p>
  
  <pre><code>production:
    adapter: postgresql
    host: 127.0.0.1
    port: 5432
    encoding: unicode
    database: JonesJems
    pool: 5
    username: &lt;%= ENV['JJ_DB_USER'] %&gt;
    password: &lt;%= ENV['JJ_DB_PASSWORD'] %&gt;
  </code></pre>
  
  <p>with the env variables being stored in etc/environment</p>