change to the data directly automatically with mig env use
[migration-tools.git] / kmig.d / bin / KMig.pm
index 45dd172..bfa5713 100644 (file)
@@ -29,6 +29,7 @@ sub db_connect {
     } else {
         $dbh = DBI->connect("dbi:Pg:dbname=$MYSQL_DATABASE", "", "") || die "Unable to connect to $MYSQL_DATABASE : $!\n";
     }
+    $dbh->do('SET NAMES utf8mb4');
     return $dbh;
 }
 
@@ -89,32 +90,6 @@ sub check_db_migschema_for_specific_table {
     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("