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;