first cut off kmig-sql, and a needed fix to kmig
authorJason Etheridge <jason@equinoxinitiative.org>
Fri, 10 Apr 2020 02:29:59 +0000 (22:29 -0400)
committerJason Etheridge <jason@equinoxinitiative.org>
Fri, 10 Apr 2020 02:29:59 +0000 (22:29 -0400)
kmig
kmig.d/bin/kmig-sql

diff --git a/kmig b/kmig
index 75d4500..1f6eff2 100755 (executable)
--- a/kmig
+++ b/kmig
@@ -241,7 +241,7 @@ Optional parameters are :
 --added_page_title and --added_page_file 
 
 If one is used both must be.  The added page file can be plain text or asciidoc.  This
-adds an extra arbitrary page of notes to the report.  Mig assumes the page file is in the kmig git directory.
+adds an extra arbitrary page of notes to the report.  KMig assumes the page file is in the kmig git directory.
 
 --tags
 
@@ -317,7 +317,7 @@ switch($ARGV[0]) {
 sub standard_invocation {
     my $cmd = shift;
 
-    if ($cmd ne 'env') { Mig::die_if_no_env_migschema(); }
+    if ($cmd ne 'env') { KMig::die_if_no_env_migschema(); }
     if (-e $mig_bin . "kmig-$cmd") {
         system( $mig_bin . "kmig-$cmd", @_ );
     } else {
index 3909ab3..535aa83 100755 (executable)
@@ -4,9 +4,11 @@
 
 =head1 NAME
 
-mig-sql 
+kmig-sql 
 
-A wrapper around the psql command.  At some point the plan is to shove mig-tracked variables into psql sessions.
+A wrapper around the mysql client.  For the Postgres/EG version of this, we
+were injecting the mig schema as a session variable, but it doesn't look like
+we can do this through the command line for mysql.
 
 =head1 SYNOPSIS
 
@@ -19,9 +21,8 @@ B<mig-sql> [arguments...]
 use strict;
 use Switch;
 use Env qw(
-    HOME PGHOST PGPORT PGUSER PGDATABASE MIGSCHEMA
-    MIGBASEWORKDIR MIGBASEGITDIR MIGGITDIR MIGWORKDIR
-    BIBSTART
+    HOME MYSQL_HOST MYSQL_TCP_PORT MYSQL_USER MYSQL_DATABASE MYSQL_PW
+    MIGSCHEMA MIGBASEWORKDIR MIGBASEGITDIR MIGGITDIR MIGWORKDIR
 );
 use Pod::Usage;
 use DBI;
@@ -29,18 +30,16 @@ use Cwd 'abs_path';
 use FindBin;
 my $mig_bin = "$FindBin::Bin/";
 use lib "$FindBin::Bin/";
-use Mig;
+use KMig;
 
 my @MYARGV = (
-     'psql'
-    ,'-vmigschema=' . $MIGSCHEMA
-    ,'-vmigschema_text=\'' . $MIGSCHEMA . '\''
-    ,'-F ' . "\t"
+     'mysql'
+    ,'--host=' . $MYSQL_HOST
+    ,'--port=' . $MYSQL_TCP_PORT
+    ,'--user=' . $MYSQL_USER
+    ,'--password=' . $MYSQL_PW
+    ,$MYSQL_DATABASE
 );
-if (defined $BIBSTART) {
-    push @MYARGV, '-vbibstart=' . $BIBSTART;
-}
-# TODO inject more mig-tracked variables here
 
 system(@MYARGV, @ARGV);