我使用Capistrano 3.2.1与Ruby 2.1.1和Rails 4.1.4,由于某些原因我无法运行迁移。
我尝试运行cap staging deploy
(部署但不运行迁移),cap staging deploy:migrate
(什么都不做),cap staging deploy:migrations
(不知道如何构建任务)
的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 }
答案 0 :(得分:3)
您需要将require 'capistrano/rails/migrations'
添加到您的Capfile
答案 1 :(得分:2)
短途旅行到capistrano-rails github解决了这个问题。我在网络服务器上失踪db
角色......
答案 2 :(得分:1)
运行"上限部署:迁移"相当于运行" cap deploy" &安培;&安培;随后"上限部署:迁移"在一个命令中。
要查看deploy:migrations的说明,只需使用-e选项:
cap -e deploy:migrations
会给你这个输出:
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.