Sha256: ad04edb9996628cf650e5c9f35a259ae44778249b13a60aaee4501d56a46918e

Contents?: true

Size: 723 Bytes

Versions: 1

Compression:

Stored size: 723 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

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

    if ENV['RAILS_ENV'] == 'development' && ::Ridgepole::ReplaceDbTask.config.migrate_with_test_when_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.3.0 lib/tasks/replaced_db.rake