clean up orphaned groupings
This commit is contained in:
parent
7ccaa371ed
commit
e41f544f4f
2 changed files with 11 additions and 1 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue