Bug 40337: Remove test of datatype

Keep the UPDATE to adjust bad data however.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2025-07-21 10:16:52 +02:00 committed by Lucas Gass
parent 827b3b41a8
commit 3ea3c2a27a
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
1 changed files with 15 additions and 51 deletions

View File

@ -8,82 +8,46 @@ return {
my ($args) = @_;
my ( $dbh, $out ) = @$args{qw(dbh out)};
my $col_type_borrowers = $dbh->selectrow_array(
$dbh->do(
q{
SELECT COLUMN_TYPE
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = DATABASE()
AND TABLE_NAME = 'borrowers'
AND COLUMN_NAME = 'checkprevcheckout'
}
);
if ( $col_type_borrowers !~ /^enum/i ) {
$dbh->do(
q{
UPDATE borrowers
SET checkprevcheckout = 'inherit'
WHERE checkprevcheckout NOT IN ('yes','no','inherit');
}
);
$dbh->do(
q{
);
$dbh->do(
q{
ALTER TABLE borrowers
MODIFY COLUMN `checkprevcheckout` enum('yes', 'no', 'inherit') NOT NULL DEFAULT 'inherit' COMMENT 'produce a warning for this patron if this item has previously been checked out to this patron if ''yes'', not if ''no'', defer to category setting if ''inherit''.'
}
);
}
my $col_type_categories = $dbh->selectrow_array(
q{
SELECT COLUMN_TYPE
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = DATABASE()
AND TABLE_NAME = 'categories'
AND COLUMN_NAME = 'checkprevcheckout'
}
);
if ( $col_type_categories !~ /^enum/i ) {
$dbh->do(
q{
$dbh->do(
q{
UPDATE categories
SET checkprevcheckout = 'inherit'
WHERE checkprevcheckout NOT IN ('yes','no','inherit');
}
);
$dbh->do(
q{
);
$dbh->do(
q{
ALTER TABLE categories
MODIFY COLUMN `checkprevcheckout` enum('yes', 'no', 'inherit') NOT NULL DEFAULT 'inherit' COMMENT 'produce a warning for this patron category if this item has previously been checked out to this patron if ''yes'', not if ''no'', defer to syspref setting if ''inherit''.'
}
);
}
my $col_type_deletedborrowers = $dbh->selectrow_array(
q{
SELECT COLUMN_TYPE
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = DATABASE()
AND TABLE_NAME = 'deletedborrowers'
AND COLUMN_NAME = 'checkprevcheckout'
}
);
if ( $col_type_deletedborrowers !~ /^enum/i ) {
$dbh->do(
q{
$dbh->do(
q{
UPDATE deletedborrowers
SET checkprevcheckout = 'inherit'
WHERE checkprevcheckout NOT IN ('yes','no','inherit');
}
);
$dbh->do(
q{
);
$dbh->do(
q{
ALTER TABLE deletedborrowers
MODIFY COLUMN `checkprevcheckout` enum('yes', 'no', 'inherit') NOT NULL DEFAULT 'inherit' COMMENT 'produce a warning for this patron if this item has previously been checked out to this patron if ''yes'', not if ''no'', defer to category setting if ''inherit''.'
}
);
}
);
},
};