原因是这样的,运维不开放正式环境数据库的alter权限,所以每次都要给他们把sql语句发过去,
由他们来操作。
https://github.com/capistrano/rails
Require everything (bundler, rails/assets and rails/migrations):# Capfilerequire 'capistrano/rails'Or require just what you need manually:# Capfilerequire 'capistrano/bundler' # Rails needs Bundler, right?require 'capistrano/rails/assets'require 'capistrano/rails/migrations'
参考的是https://github.com/capistrano/rvm/issues/49
Using the task pattern described before, capistrano/rvm gets required after capistrano/bundler. This makes capistrano use the command bundle exec ruby --version. This command would fail on the server when it is run inside a directory without a Gemfile.There are two ways to make this work:1) Avoid using bundle exec for all ruby commands:Capfiletask :require_rvm do require 'capistrano/rvm'endtask 'staging' => [:require_rvm]require 'capistrano/bundler'config/deploy/staging.rbset :bundle_bins, %w(gem rake rails)2) Require bundler the same way we require rvm:Capfiletask :require_rvm do require 'capistrano/rvm'endtask :require_bundler do require 'capistrano/bundler'endtask 'staging' => [:require_rvm, :require_bundler]task 'production' => [:require_bundler]
以下是最终修改后的Capfile
task :require_rails do require 'capistrano/rails'end# require 'capistrano/rvm'require 'capistrano/rbenv'# require 'capistrano/chruby'task :require_rails_without_migrations do require 'capistrano/bundler' require 'capistrano/rails/assets'end# require 'capistrano/rails/migrations'# require 'capistrano/passenger'task :staging => [:require_rails]task :production => [:require_rails_without_migrations]