Sha256: 955287103c886cb5a329c1ae757aefd68842db82ee5d47f9698878a5efb8d86e

Contents?: true

Size: 617 Bytes

Versions: 1

Compression:

Stored size: 617 Bytes

Contents

require "ridgepole/replace_db_task/executor"

namespace :db do
  def apply(rails_env, options, &block)
    ::Ridgepole::ReplaceDbTask::Executor.call(rails_env, options, block)
  end

  task migrate: :environment do
    ENV['RAILS_ENV'] ||= 'development'
    apply(ENV['RAILS_ENV'], '--apply') { |line| puts line }

    if ENV['RAILS_ENV'] == 'development'
      apply('test', '--apply') { |line| puts line }
    end
  end

  desc 'apply dry run'
  task apply_dry_run: :environment do
    ENV['RAILS_ENV'] ||= 'development'

    apply(ENV['RAILS_ENV'], '--apply --dry-run') do |line|
      puts line
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ridgepole-replace_db_task-0.1.0 lib/tasks/db.rake