Skip to content

Commit

Permalink
feat: ensure clean up script handles pact versions for left over veri…
Browse files Browse the repository at this point in the history
…fications
  • Loading branch information
bethesque committed Jul 3, 2019
1 parent bdff98c commit 116f8ea
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions script/prod/clean-up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
-- 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 verifications WHERE created_at < now() - '60 days'::interval;
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 pact_versions WHERE id NOT IN (SELECT pact_version_id FROM pact_publications UNION SELECT pact_version_id FROM verifications);
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);

0 comments on commit 116f8ea

Please sign in to comment.