} else {
$dbh = DBI->connect("dbi:Pg:dbname=$MYSQL_DATABASE", "", "") || die "Unable to connect to $MYSQL_DATABASE : $!\n";
}
+ $dbh->do('SET NAMES utf8mb4');
return $dbh;
}
}
sub check_for_db_migschema {
- return 1; # the schema is the same as the database name, which is the same as the koha instance name, in most cases
+ # the schema is the same as the database name, which is the same
+ # as the koha instance name prefixed with 'koha_', in most cases
+ return 1;
}
sub check_db_migschema_for_migration_tables {
return $found;
}
-sub check_for_migration_tools {
- my $dbh = db_connect();
- my $sth = $dbh->prepare("
- SELECT EXISTS(
- SELECT 1
- FROM information_schema.tables
- WHERE table_schema = " . $dbh->quote( $MYSQL_DATABASE ) . "
- AND table_name = " . $dbh->quote( 'mt_init' ) . "
- );"
- );
- my $rv = $sth->execute()
- || die "Error checking for migration_tools: $!";
- my @cols = $sth->fetchrow_array;
- $sth->finish;
- db_disconnect($dbh);
- return $cols[0];
-}
-
-sub die_if_no_migration_tools {
- if (check_for_migration_tools()) {
- print "Found migration_tools\n";
- } else {
- die "Missing migration_tools\n";
- }
-}
-
sub check_for_mig_tracking_table {
my $dbh = db_connect();
my $sth = $dbh->prepare("