-
-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
11 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
-- Deletes all verifications and pact publications that are older than 60 days, | ||
-- and cleans up orphan pacticipant versions and their tags. | ||
-- Also removes webhook execution history. | ||
|
||
DELETE FROM verifications WHERE created_at < now() - '60 days'::interval; | ||
DELETE FROM webhook_executions; | ||
DELETE FROM triggered_webhooks; | ||
DELETE FROM pact_publications WHERE created_at < now() - '60 days'::interval; | ||
DELETE FROM pact_versions WHERE id NOT IN (SELECT distinct pact_version_id from pact_publications); | ||
DELETE FROM tags WHERE version_id NOT IN (select consumer_version_id from pact_publications union select provider_version_id from verifications); | ||
DELETE FROM versions WHERE id NOT IN (select consumer_version_id from pact_publications union select provider_version_id from verifications); |