Class: PactBroker::DB::CleanIncremental

Inherits:
Object
  • Object
show all
Defined in:
lib/pact_broker/db/clean_incremental.rb

Constant Summary collapse

DEFAULT_KEEP_SELECTORS =
[
  PactBroker::DB::Clean::Selector.new(tag: true, latest: true),
  PactBroker::DB::Clean::Selector.new(branch: true, latest: true),
  PactBroker::DB::Clean::Selector.new(latest: true),
  PactBroker::DB::Clean::Selector.new(deployed: true),
  PactBroker::DB::Clean::Selector.new(released: true),
  PactBroker::DB::Clean::Selector.new(max_age: 90)
]
TABLES =
[:versions, :pact_publications, :pact_versions, :verifications, :triggered_webhooks, :webhook_executions]

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(database_connection, options = {}) ⇒ CleanIncremental

Returns a new instance of CleanIncremental.



23
24
25
26
# File 'lib/pact_broker/db/clean_incremental.rb', line 23

def initialize database_connection, options = {}
  @db = database_connection
  @options = options
end

Class Method Details

.call(database_connection, options = {}) ⇒ Object



19
20
21
# File 'lib/pact_broker/db/clean_incremental.rb', line 19

def self.call database_connection, options = {}
  new(database_connection, options).call
end

Instance Method Details

#callObject



28
29
30
31
32
33
34
35
36
# File 'lib/pact_broker/db/clean_incremental.rb', line 28

def call
  require "pact_broker/db/models"

  if dry_run?
    dry_run_results
  else
    execute_clean
  end
end