X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fqueue_depend.pm;h=f21ed994649ffaeb47dfa8665622cb273c98a2ec;hp=bc910d8e911c35acb81fa6d30c37ee260a2566ea;hb=ffa18709ee8a4d05e18d2d406cf73afe79e52524;hpb=eb9668a6f3181ee02cb335272c5ee4616e61fd09 diff --git a/FS/FS/queue_depend.pm b/FS/FS/queue_depend.pm index bc910d8e9..f21ed9946 100644 --- a/FS/FS/queue_depend.pm +++ b/FS/FS/queue_depend.pm @@ -1,11 +1,8 @@ package FS::queue_depend; +use base qw( FS::Record ); use strict; -use vars qw( @ISA ); -use FS::Record qw( qsearch qsearchs ); -use FS::queue; - -@ISA = qw(FS::Record); +use FS::Record qw( dbh ); =head1 NAME @@ -43,7 +40,7 @@ inherits from FS::Record. The following fields are currently supported: The job specified by B depends on the job specified B - the B job will not be run until the B job has completed -sucessfully (or manually removed). +successfully (or manually removed). =head1 METHODS @@ -109,6 +106,21 @@ sub check { =back +=cut + +sub _upgrade_schema { + my ($class, %opts) = @_; + + my $sql = ' + DELETE FROM queue_depend WHERE NOT EXISTS + ( SELECT 1 FROM queue WHERE queue.jobnum = queue_depend.jobnum ) + '; + + my $sth = dbh->prepare($sql) or die dbh->errstr; + $sth->execute or die $sth->errstr; + ''; +} + =head1 BUGS =head1 SEE ALSO