Sha256: e842bb6e2bae818df76236a027f1d7a8984cfe62720f366c046b73cdb92590ad

Contents?: true

Size: 629 Bytes

Versions: 2

Compression:

Stored size: 629 Bytes

Contents

# frozen_string_literal: true

require 'dry/transaction/operation'
require 'pg_export/import'

class PgExport
  module Operations
    class RemoveOldDumps
      include Dry::Transaction::Operation
      include Import['repositories.gateway_dump_repository', 'config']

      def call(dump:, gateway:)
        dumps = gateway_dump_repository.by_database_name(
          database_name: dump.database,
          gateway: gateway,
          offset: config.keep_dumps
        )
        dumps.each do |d|
          gateway.delete(d.name)
        end

        Success(removed_dumps: dumps, gateway: gateway)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pg_export-1.0.0.rc5 lib/pg_export/lib/pg_export/operations/remove_old_dumps.rb
pg_export-1.0.0.rc4 lib/pg_export/lib/pg_export/operations/remove_old_dumps.rb