Bug 15072: (followup) fix spaces and consistency
[koha.git] / misc / migration_tools / 22_to_30 / convert_to_utf8.pl
blobfbbff89c604265e002538058fe3f5e8edc7a0b4a
1 #!/usr/bin/perl
3 # small script to convert mysql tables to utf-8
5 use strict;
6 use warnings;
8 BEGIN {
10 # find Koha's Perl modules
11 # test carefully before changing this
12 use FindBin;
13 eval { require "$FindBin::Bin/../../kohalib.pl" };
16 use C4::Context;
17 my $dbh = C4::Context->dbh();
18 my $sth = $dbh->prepare("Show tables");
19 $sth->execute();
20 while (my @table = $sth->fetchrow_array()) {
21 print "Altering table $table[0]\n";
22 my $alter_query = "ALTER TABLE $table[0] convert to CHARACTER SET UTF8 collate utf8_general_ci";
23 my $sth2 = $dbh->prepare($alter_query);
24 $sth2->execute();
25 $sth2->finish();