0
votes

I am using capistrano 3 and I run cap staging deploy. After various commands, it then runs rake db:migrate, which looks like this:

INFO [f67aeefb] Running /usr/local/rvm/bin/rvm ruby-2.1.2@core do bundle exec rake db:migrate as deploy@10.10.4.131 DEBUG [f67aeefb] Command: cd /var/www/mysite_staging/releases/20150617233945 && ( RAILS_ENV=staging /usr/local/rvm/bin/rvm ruby-2.1.2@core do bundle exec rake db:migrate ) DEBUG [f67aeefb] "Env => staging"

The problem is the migration appears to have run in production, not in staging.

How can I ensure capistrano runs the migrations in staging when I specify staging during the deploy?

1

1 Answers

0
votes

I'm not sure which of it did it, but by adding the following to staging.rb:

set :rails_env, 'staging'
set :database_name, 'core_staging'

And then in my apache virtual host adding:

RailsEnv staging

It seems to now recognize the staging database.