diff options
author | Ivan Kohler <ivan@freeside.biz> | 2017-03-10 10:14:05 -0800 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2017-03-10 10:14:05 -0800 |
commit | f9859a1893c22322fcb3f3aa7c4a022a5d919897 (patch) | |
tree | 557744c6b9db3c1964fe1c2b411fcc5a1dab9360 /FS/FS/cust_event_fee.pm | |
parent | 04fef32b85b84f388cc5c6f8b7bbe5baa6fc5307 (diff) |
fix upgrade for dangling cust_event_fee (how?), RT#75113
Diffstat (limited to 'FS/FS/cust_event_fee.pm')
-rw-r--r-- | FS/FS/cust_event_fee.pm | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/FS/FS/cust_event_fee.pm b/FS/FS/cust_event_fee.pm index 375a533..5db4039 100644 --- a/FS/FS/cust_event_fee.pm +++ b/FS/FS/cust_event_fee.pm @@ -1,8 +1,8 @@ package FS::cust_event_fee; +use base qw( FS::Record FS::FeeOrigin_Mixin ); use strict; -use base qw( FS::Record FS::FeeOrigin_Mixin ); -use FS::Record qw( qsearch qsearchs ); +use FS::Record qw( qsearch dbh ); =head1 NAME @@ -194,6 +194,24 @@ sub cust_pkg { } } +=back + +=cut + +sub _upgrade_schema { + my ($class, %opts) = @_; + + my $sql = ' + DELETE FROM cust_event_Fee WHERE NOT EXISTS + ( SELECT 1 FROM cust_event WHERE cust_event.eventnum = cust_event_fee.eventnum ) + '; + + my $sth = dbh->prepare($sql) or die dbh->errstr; + $sth->execute or die $sth->errstr; + ''; +} + + =head1 BUGS =head1 SEE ALSO |