Skip to content

Commit 388b441

Browse files
committed
feat: added clean up sql script
1 parent 06584f0 commit 388b441

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

script/prod/clean-up.sql

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
-- Deletes all verifications and pact publications that are older than 60 days,
2+
-- and cleans up orphan pacticipant versions and their tags.
3+
-- Also removes webhook execution history.
4+
5+
DELETE FROM verifications WHERE created_at < now() - '60 days'::interval;
6+
DELETE FROM webhook_executions;
7+
DELETE FROM triggered_webhooks;
8+
DELETE FROM pact_publications WHERE created_at < now() - '60 days'::interval;
9+
DELETE FROM pact_versions WHERE id NOT IN (SELECT distinct pact_version_id from pact_publications);
10+
DELETE FROM tags WHERE version_id NOT IN (select consumer_version_id from pact_publications union select provider_version_id from verifications);
11+
DELETE FROM versions WHERE id NOT IN (select consumer_version_id from pact_publications union select provider_version_id from verifications);

0 commit comments

Comments
 (0)