I'm using Capistrano 3.2.1 with Ruby 2.1.1 and Rails 4.1.4 and for some reason I'm unable to run migrations.
I tried running cap staging deploy
(deploys but doesn't run migrations), cap staging deploy:migrate
(does nothing), cap staging deploy:migrations
(don't know how to build task).
Gemfile:
group :development, :test do
gem 'capistrano', '~> 3.2.1'
gem 'capistrano-rails', '~> 1.1.1'
gem 'capistrano-rvm'
end
Capfile:
set :deploy_config_path, 'config/capistrano/deploy.rb'
set :stage_config_path, 'config/capistrano/deploy'
require 'capistrano/setup'
require 'capistrano/deploy'
require 'capistrano/rails'
require 'capistrano/rvm'
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
您需要在Capfile中添加require'capistrano require 'capistrano/rails/migrations'
A short trip to capistrano-rails github solved the problem. I was missing db
role on my webservers...
Running "cap deploy:migrations" is equivalent to running "cap deploy" && subsequently "cap deploy:migrate" in one command.
To view the description for deploy:migrations, just use the -e option:
cap -e deploy:migrations
will give you this output:
cap deploy:migrations
Deploy and run pending migrations. This will work similarly to the 'deploy' task, but will also run any pending migrations (via the 'deploy:migrate' task) prior to updating the symlink. Note that the update in this case it is not atomic, and transactions are not used, because migrations are not guaranteed to be reversible.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.