[freeside-commits] branch FREESIDE_4_BRANCH updated. 65cb2bea6e8e93e268d45b523efe1a6666c521f6
Ivan
ivan at 420.am
Fri Mar 10 11:58:03 PST 2017
The branch, FREESIDE_4_BRANCH has been updated
via 65cb2bea6e8e93e268d45b523efe1a6666c521f6 (commit)
from 1f485a64aa2868036eb17e122191ab8e8868a947 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 65cb2bea6e8e93e268d45b523efe1a6666c521f6
Author: Ivan Kohler <ivan at freeside.biz>
Date: Fri Mar 10 11:58:02 2017 -0800
fix upgrade for dangling queue_depend, RT#75117
diff --git a/FS/FS/Upgrade.pm b/FS/FS/Upgrade.pm
index 3b76bb5..c860453 100644
--- a/FS/FS/Upgrade.pm
+++ b/FS/FS/Upgrade.pm
@@ -577,6 +577,7 @@ sub upgrade_schema_data {
'cust_bill_pay_batch' => [],
'cust_event_fee' => [],
'radius_attr' => [],
+ 'queue_depend' => [],
#update records referencing removed things with their FKs
'cust_pkg' => [],
;
diff --git a/FS/FS/queue_depend.pm b/FS/FS/queue_depend.pm
index cd3f787..f21ed99 100644
--- a/FS/FS/queue_depend.pm
+++ b/FS/FS/queue_depend.pm
@@ -1,7 +1,8 @@
package FS::queue_depend;
-use base qw(FS::Record);
+use base qw( FS::Record );
use strict;
+use FS::Record qw( dbh );
=head1 NAME
@@ -105,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
-----------------------------------------------------------------------
Summary of changes:
FS/FS/Upgrade.pm | 1 +
FS/FS/queue_depend.pm | 18 +++++++++++++++++-
2 files changed, 18 insertions(+), 1 deletion(-)
More information about the freeside-commits
mailing list