Bug 7613: OCLC Connexion web service and desktop client, followup patch
[koha.git] / misc / migration_tools / 22_to_30 / convert_to_utf8.pl
1 #!/usr/bin/perl
2
3 # small script to convert mysql tables to utf-8
4
5 use strict;
6 use warnings;
7
8 BEGIN {
9
10     # find Koha's Perl modules
11     # test carefully before changing this
12     use FindBin;
13     eval { require "$FindBin::Bin/../../kohalib.pl" };
14 }
15
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();
26 }