tasks/database.rb in pact_broker-2.4.2 vs tasks/database.rb in pact_broker-2.5.0
- old
+ new
@@ -7,11 +7,11 @@
Sequel.extension :migration
module PactBroker
module Database
- TABLES = [:labels, :webhook_executions, :config, :pacts, :pact_version_contents, :tags, :verifications, :pact_publications, :pact_versions, :webhook_headers, :webhooks, :versions, :pacticipants].freeze
+ TABLES = [:labels, :webhook_executions, :triggered_webhooks, :config, :pacts, :pact_version_contents, :tags, :verifications, :pact_publications, :pact_versions, :webhook_headers, :webhooks, :versions, :pacticipants].freeze
extend self
def migrate target = nil
opts = target ? {target: target} : {}
@@ -75,10 +75,15 @@
end
def truncate
TABLES.each do | table_name |
if database.table_exists?(table_name)
- database[table_name].delete
+ begin
+ database[table_name].delete
+ rescue SQLite3::ConstraintException => e
+ puts "Could not delete the following records from #{table_name}: #{database[table_name].select_all}"
+ raise e
+ end
end
end
end
def database= database