0

When I used custom db:migrate task from capistrano/rails information about migrate processing isn't shown. To change that I customized db:migrate task and change log_level to :debug.

  info '[deploy:migrate] Run `rake db:migrate`'
    within release_path do
      with rails_env: fetch(:rails_env) do
        has_verbosity = defined?(SSHKit) && SSHKit.respond_to?(:config) && SSHKit.config.respond_to?(:output_verbosity)
        if has_verbosity
          verbosity_level = SSHKit.config.output_verbosity
          SSHKit.config.output_verbosity = 0 # Logger::DEBUG
        end

        execute :rake, "db:migrate"

        SSHKit.config.output_verbosity = verbosity_level if has_verbosity
      end
    end

All seems OK, but information about processing migration shows after that all migration are finished. But I want to show that information by steps (1. Migration 1 finished; 2. Info about that added to log; 3. Migration 2 finished; 4. Info about that added to log.). At now it works like: 1. Migration 1 finished; 2. Migration 2 finished; 4. Info about all migrations added to log.

  • Are you sure you haven't defined the migration task twice? It might be running the first time with no logging, and then a second time with logging (which runs very fast and is why you see all output at once). Defining Rake tasks is additive by default, so you have to explicitly un-define the default migrate task before declaring yours. – Matt Brictson Jan 26 '16 at 18:21

1 Answers1

0

Thanks for the help. I've disabled default migrate task with Rake::Task['deploy:migrate'].clear and this isn't worked for me. I've researched gem sshkit-1.8.1 and found out that just needed to add set :pty, true to your deploy.rb.