File tree 2 files changed +13
-1
lines changed
2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,16 @@ def initialize database_connection, options = {}
14
14
end
15
15
16
16
def call
17
- db [ :verifications ] . where ( id : db [ :head_matrix ] . select ( :verification_id ) ) . invert . delete
17
+ # TODO head matrix is the head for the consumer tags, not the provider tags.
18
+ # Work out how to keep the head verifications for the provider tags.
19
+ verification_ids = db [ :verifications ] . where ( id : db [ :head_matrix ] . select ( :verification_id ) ) . invert . select ( :verification_id )
20
+
21
+ triggered_webhook_ids = db [ :triggered_webhooks ] . where ( verification_id : verification_ids ) . select ( :id )
22
+ db [ :webhook_executions ] . where ( triggered_webhook_id : triggered_webhook_ids ) . delete
23
+ db [ :triggered_webhooks ] . where ( id : triggered_webhook_ids ) . delete
24
+
25
+ verification_ids . delete
26
+
18
27
pp_ids = db [ :head_matrix ] . select ( :pact_publication_id )
19
28
20
29
triggered_webhook_ids = db [ :triggered_webhooks ] . where ( pact_publication_id : pp_ids ) . invert . select ( :id )
Original file line number Diff line number Diff line change @@ -26,6 +26,9 @@ module DB
26
26
. create_webhook_execution
27
27
. create_deprecated_webhook_execution
28
28
. create_verification ( provider_version : "30" )
29
+ . create_verification_webhook
30
+ . create_triggered_webhook
31
+ . create_webhook_execution
29
32
. create_consumer_version ( "3" )
30
33
. create_pact
31
34
. comment ( "keep" )
You can’t perform that action at this time.
0 commit comments