Class: PactBroker::DB::DeleteOverwrittenData
- Inherits:
-
Object
- Object
- PactBroker::DB::DeleteOverwrittenData
- Defined in:
- lib/pact_broker/db/delete_overwritten_data.rb
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(database_connection, options = {}) ⇒ DeleteOverwrittenData
constructor
A new instance of DeleteOverwrittenData.
Constructor Details
#initialize(database_connection, options = {}) ⇒ DeleteOverwrittenData
Returns a new instance of DeleteOverwrittenData.
11 12 13 14 15 |
# File 'lib/pact_broker/db/delete_overwritten_data.rb', line 11 def initialize database_connection, = {} @db = database_connection @options = @before = [:before] || DateTime.now end |
Class Method Details
.call(database_connection, options = {}) ⇒ Object
7 8 9 |
# File 'lib/pact_broker/db/delete_overwritten_data.rb', line 7 def self.call database_connection, = {} new(database_connection, ).call end |
Instance Method Details
#call ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/pact_broker/db/delete_overwritten_data.rb', line 17 def call deleted_counts = {} kept_counts = {} deleted_counts.merge!(delete_overwritten_pact_publications) deleted_counts.merge!(delete_overwritten_verifications) deleted_counts.merge!(delete_orphan_pact_versions) kept_counts[:pact_publications] = db[:pact_publications].count kept_counts[:verification_results] = db[:verifications].count kept_counts[:pact_versions] = db[:pact_versions].count { deleted: deleted_counts, kept: kept_counts } end |