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)
]
DEFAULT_KEEP_BRANCH_SELECTORS =
[
  PactBroker::DB::Clean::BranchSelector.new(max_age: 90)
]
TABLES =
[:versions, :pact_publications, :pact_versions, :verifications, :triggered_webhooks, :webhook_executions, :branches]

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of CleanIncremental.



27
28
29
30
# File 'lib/pact_broker/db/clean_incremental.rb', line 27

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

Class Method Details

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



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

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

Instance Method Details

#callObject



32
33
34
35
36
37
38
39
40
# File 'lib/pact_broker/db/clean_incremental.rb', line 32

def call
  require "pact_broker/db/models"

  if dry_run?
    dry_run_results
  else
    execute_clean
  end
end