Bug 18801: [Follow-up] Dbrev to repair bad auth type codes
[koha.git] / installer / data / mysql / atomicupdate / bug18801.perl
1 $DBversion = 'XXX';  # will be replaced by the RM
2 if( CheckVersion( $DBversion ) ) {
3     # Fetch all auth types
4     my $authtypes = $dbh->selectcol_arrayref( q|SELECT authtypecode FROM auth_types| );
5
6     if( grep { $_ eq 'Default' } @$authtypes ) {
7         # If this exists as an authtypecode, we don't do anything
8     } else {
9         # Replace the incorrect Default by empty string
10         $dbh->do( q|UPDATE auth_header SET authtypecode='' WHERE authtypecode='Default'| );
11     }
12
13     SetVersion( $DBversion );
14     print "Upgrade to $DBversion done (Bug 18801 - Update incorrect Default auth type codes)\n";
15 }