码迷,mamicode.com
首页 > 数据库 > 详细

修改Capfile,在正式环境不再使用migration修改数据库

时间:2016-03-29 16:22:09      阅读:242      评论:0      收藏:0      [点我收藏+]

标签:

 

原因是这样的,运维不开放正式环境数据库的alter权限,所以每次都要给他们把sql语句发过去,

由他们来操作。

参考的是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:

Capfile

task :require_rvm do
  require capistrano/rvm
end
task staging => [:require_rvm]

require capistrano/bundler
config/deploy/staging.rb

set :bundle_bins, %w(gem rake rails)
2) Require bundler the same way we require rvm:

Capfile

task :require_rvm do
  require capistrano/rvmend

task :require_bundler do
  require capistrano/bundler
end

task 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]

 

修改Capfile,在正式环境不再使用migration修改数据库

标签:

原文地址:http://www.cnblogs.com/iwangzheng/p/5333171.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!