Sha256: 3166dd6c71dc6ed0b7b8792bac45de9b662295eddbcd3964d9c1d8f9aee43430

Contents?: true

Size: 1.13 KB

Versions: 32

Compression:

Stored size: 1.13 KB

Contents

module PactBroker
  module DB
    class DeleteOverwrittenDataTask < ::Rake::TaskLib
      attr_accessor :database_connection
      attr_accessor :age_in_days

      def initialize &block
        rake_task &block
      end

      def rake_task &block
        namespace :pact_broker do
          namespace :db do
            desc "Delete overwritten pacts and verifications from database"
            task :delete_overwritten_data do | t, args |
              require 'pact_broker/db/delete_overwritten_data'
              require 'yaml'

              instance_eval(&block)
              options = {}

              if age_in_days
                options[:before] = (Date.today - age_in_days.to_i).to_datetime
                $stdout.puts "Deleting overwritten pact publications and verifications older than #{age_in_days} days"
              else
                $stdout.puts "Deleting overwritten pact publications and verifications"
              end

              report = PactBroker::DB::DeleteOverwrittenData.call(database_connection, options)
              $stdout.puts report.to_yaml
            end
          end
        end
      end
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
pact_broker-2.71.0 lib/pact_broker/tasks/delete_overwritten_data_task.rb
pact_broker-2.70.0 lib/pact_broker/tasks/delete_overwritten_data_task.rb
pact_broker-2.69.0 lib/pact_broker/tasks/delete_overwritten_data_task.rb
pact_broker-2.68.1 lib/pact_broker/tasks/delete_overwritten_data_task.rb
pact_broker-2.68.0 lib/pact_broker/tasks/delete_overwritten_data_task.rb
pact_broker-2.67.0 lib/pact_broker/tasks/delete_overwritten_data_task.rb
pact_broker-2.66.0 lib/pact_broker/tasks/delete_overwritten_data_task.rb
pact_broker-2.65.0 lib/pact_broker/tasks/delete_overwritten_data_task.rb
pact_broker-2.64.0 lib/pact_broker/tasks/delete_overwritten_data_task.rb
pact_broker-2.63.0 lib/pact_broker/tasks/delete_overwritten_data_task.rb
pact_broker-2.62.0 lib/pact_broker/tasks/delete_overwritten_data_task.rb
pact_broker-2.61.0 lib/pact_broker/tasks/delete_overwritten_data_task.rb
pact_broker-2.60.1 lib/pact_broker/tasks/delete_overwritten_data_task.rb
pact_broker-2.60.0 lib/pact_broker/tasks/delete_overwritten_data_task.rb
pact_broker-2.59.2 lib/pact_broker/tasks/delete_overwritten_data_task.rb
pact_broker-2.59.1 lib/pact_broker/tasks/delete_overwritten_data_task.rb
pact_broker-2.59.0 lib/pact_broker/tasks/delete_overwritten_data_task.rb
pact_broker-2.58.3 lib/pact_broker/tasks/delete_overwritten_data_task.rb
pact_broker-2.58.2 lib/pact_broker/tasks/delete_overwritten_data_task.rb
pact_broker-2.58.0 lib/pact_broker/tasks/delete_overwritten_data_task.rb