From e41f544f4f486c80bde3ea7024403108c8f4bcac Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Mon, 1 Oct 2007 18:06:55 +0000 Subject: [PATCH] clean up orphaned groupings --- docs/changelog/7.x.x.txt | 1 + docs/upgrades/upgrade_7.4.8-7.4.9.pl | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index f92f84287..7e83f261c 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -1,6 +1,7 @@ 7.4.9 - fix: Bug that did not allow Calendar Update Feeds workflow activity to complete + - Clean up orphaned grouping - fix: purging old asset revisions on large sites never completes 7.4.8 diff --git a/docs/upgrades/upgrade_7.4.8-7.4.9.pl b/docs/upgrades/upgrade_7.4.8-7.4.9.pl index c370077d3..74383b515 100644 --- a/docs/upgrades/upgrade_7.4.8-7.4.9.pl +++ b/docs/upgrades/upgrade_7.4.8-7.4.9.pl @@ -20,11 +20,20 @@ my $quiet; # this line required my $session = start(); # this line required -# upgrade functions go here +removeOrphanedGroupings($session); # upgrade functions go here finish($session); # this line required +#------------------------------------------------- +sub removeOrphanedGroupings { + my $session = shift; + print "\tCleaning up stale groupings.\n" unless ($quiet); + $session->db->write("delete from groupGroupings where inGroup not in (select distinct groupId from groups)"); + $session->db->write("delete from groupings where groupId not in (select distinct groupId from groups)"); +} + + ##------------------------------------------------- #sub exampleFunction { # my $session = shift;