don't print out warnings about SQL RADIUS FreesideStatus every time either. really?
[freeside.git] / FS / FS / Upgrade.pm
index dec4d48..c223674 100644 (file)
@@ -6,7 +6,7 @@ use Exporter;
 use Tie::IxHash;
 use FS::UID qw( dbh driver_name );
 use FS::Conf;
-use FS::Record;
+use FS::Record qw(qsearchs str2time_sql);
 
 use FS::svc_domain;
 $FS::svc_domain::whois_hack = 1;
@@ -100,6 +100,9 @@ sub upgrade_data {
     #populate part_pkg_taxclass for starters
     'part_pkg_taxclass' => [],
 
+    #remove bad pending records
+    'cust_pay_pending' => [],
+
   ;
 
   \%hash;
@@ -114,8 +117,10 @@ sub upgrade_sqlradius {
   my @part_export = FS::part_export::sqlradius->all_sqlradius_withaccounting();
 
   foreach my $part_export ( @part_export ) {
-    my $dbh = DBI->connect( map $part_export->option($_),
-                             qw ( datasrc username password ) );
+    my $dbh = DBI->connect(
+      ( map $part_export->option($_), qw ( datasrc username password ) ),
+      { PrintError => 0, PrintWarn => 0 }
+    );
   
     my $str2time = str2time_sql( $dbh->{Driver}->{Name} );
     my $group = "UserName";
@@ -132,6 +137,13 @@ sub upgrade_sqlradius {
       $sth_update->execute or die $sth_update->errstr;
     }
 
+    my $sth_index = $dbh->prepare(
+      "CREATE INDEX FreesideStatus ON radacct ( FreesideStatus )"
+    );
+    if ( $sth_index ) {
+      $sth_index->execute;
+    }
+
     my $sth = $dbh->prepare("SELECT UserName,
                                     Realm,
                                     $str2time max(AcctStartTime)),