clean up orphaned groupings

This commit is contained in:
Graham Knop 2007-10-01 18:06:55 +00:00
parent 7ccaa371ed
commit e41f544f4f
2 changed files with 11 additions and 1 deletions

View file

@ -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;