Koha/misc/migration_tools/22_to_30/convert_to_utf8.pl
Jonathan Druart 238fabc4ab Bug 28617: Remove kohalib.pl and rely on PERL5LIB
The purpose of this script was to load the relevant Koha lib for the
different scripts (installation, cronjob, CLI, etc.)
However it is not used consistently and we prefer to rely on PERL5LIB.

From bug 28617 comment 6 from Galen:
"""
Time marches on, and one of the motivations for having kohalib.pl - making
it possible to install Koha without setting a single environment variable -
has been obviated by the vast improvements in the ease of installing Koha.

Consequently, I think kohalib.pl can go away.
"""

Test plan:
confirm that the changes make sense and that kohalib.pl can be removed
safely.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2021-12-07 12:16:28 -10:00

18 lines
479 B
Perl
Executable file

#!/usr/bin/perl
# small script to convert mysql tables to utf-8
use strict;
use warnings;
use C4::Context;
my $dbh = C4::Context->dbh();
my $sth = $dbh->prepare("Show tables");
$sth->execute();
while (my @table = $sth->fetchrow_array()) {
print "Altering table $table[0]\n";
my $alter_query = "ALTER TABLE $table[0] convert to CHARACTER SET UTF8 collate utf8_general_ci";
my $sth2 = $dbh->prepare($alter_query);
$sth2->execute();
$sth2->finish();
}