first cut off kmig-sql, and a needed fix to kmig
[migration-tools.git] / kmig.d / bin / kmig-sql
1 #!/usr/bin/perl -w
2 ###############################################################################
3 =pod
4
5 =head1 NAME
6
7 kmig-sql 
8
9 A wrapper around the mysql client.  For the Postgres/EG version of this, we
10 were injecting the mig schema as a session variable, but it doesn't look like
11 we can do this through the command line for mysql.
12
13 =head1 SYNOPSIS
14
15 B<mig-sql> [arguments...]
16
17 =cut
18
19 ###############################################################################
20
21 use strict;
22 use Switch;
23 use Env qw(
24     HOME MYSQL_HOST MYSQL_TCP_PORT MYSQL_USER MYSQL_DATABASE MYSQL_PW
25     MIGSCHEMA MIGBASEWORKDIR MIGBASEGITDIR MIGGITDIR MIGWORKDIR
26 );
27 use Pod::Usage;
28 use DBI;
29 use Cwd 'abs_path';
30 use FindBin;
31 my $mig_bin = "$FindBin::Bin/";
32 use lib "$FindBin::Bin/";
33 use KMig;
34
35 my @MYARGV = (
36      'mysql'
37     ,'--host=' . $MYSQL_HOST
38     ,'--port=' . $MYSQL_TCP_PORT
39     ,'--user=' . $MYSQL_USER
40     ,'--password=' . $MYSQL_PW
41     ,$MYSQL_DATABASE
42 );
43
44 system(@MYARGV, @ARGV);
45
46 exit 0;
47