title: Why Does First Deploy with Capistrano Run db:migrate?
body: <p>I'm using Capistrano to deploy to production for the first time, and I'm getting an error when I run </p>
  
  <p><code>cap production deploy</code></p>
  
  <p>The error is:</p>
  
  <pre><code>** Invoke deploy:migrate (first_time)
  ** Invoke deploy:set_rails_env
  ** Execute deploy:migrate
  DEBUG [048f89c6] Running /usr/bin/env if test ! -d /home/deployer_user/apps/ap_production/releases/20140209005208; then echo "Directory does not exist '/home/deployer_user/apps/ap_production/releases/20140209005208'" 1&gt;&amp;2; false; fi on eslope.net
  DEBUG [048f89c6] Command: if test ! -d /home/deployer_user/apps/ap_production/releases/20140209005208; then echo "Directory does not exist '/home/deployer_user/apps/ap_production/releases/20140209005208'" 1&gt;&amp;2; false; fi
  DEBUG [048f89c6] Finished in 0.160 seconds with exit status 0 (successful).
  INFO [52f75214] Running ~/.rbenv/bin/rbenv exec bundle exec rake db:migrate on eserver.net
  DEBUG [52f75214] Command: cd /home/deployer_user/apps/ap_production/releases/20140209005208 &amp;&amp; ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.1.0 RAILS_ENV=production ~/.rbenv/bin/rbenv exec bundle exec rake db:migrate )
  DEBUG [52f75214]    rake aborted!
  DEBUG [52f75214]    An error has occurred, this and all later migrations canceled:
  DEBUG [52f75214]    
  DEBUG [52f75214]    PG::UndefinedTable: ERROR:  relation "client_infos" does not exist
  DEBUG [52f75214]    : ALTER TABLE "client_infos" RENAME TO "clients
  </code></pre>
  
  <p>The error actually makes complete sense. The referenced table doesn't exist. What I don't understand is why the migration is running at all? Why isn't the the database just being created from the schema on the first run.  Did I inadvertently remove a file that says what migrations have been run? Either by just deleting it, or by ".gitignoring" it?</p>
  
  <p>I think I know how I can fix it (rake db:create or similar) but what I don't understand is, if in Capistrano v3 it knows it's a first time, why it would not use the schema directly rather than run all the migrations?  I'm a noob, that seems reasonable, but on the other hand, running the migrations would achieve the same result, so... (But what about folks who don't what to use the migrations blindly in production; won't they be stuck?)  Thanks.</p>