Mig wrapper for psql. Plan is to start injecting some useful mig-tracked
variables into psql sessions thus invoked.
Signed-off-by: Jason Etheridge <jason@esilibrary.com>
Generates <parent table>_prod.sql for the specified linked and mapped file, or
all such files if no file is specified.
+=item B<sql> [arguments...]
+
+A wrapper around the psql command. At some point the plan is to shove mig-tracked variables into psql sessions.
+
=back
=cut
Mig::die_if_no_env_migschema();
standard_invocation(@ARGV);
}
+ case "sql" {
+ Mig::die_if_no_env_migschema();
+ standard_invocation(@ARGV);
+ }
case "map" {
Mig::die_if_no_env_migschema();
}
--- /dev/null
+#!/usr/bin/perl -w
+###############################################################################
+=pod
+
+=head1 NAME
+
+mig-sql
+
+A wrapper around the psql command. At some point the plan is to shove mig-tracked variables into psql sessions.
+
+=head1 SYNOPSIS
+
+B<mig-sql> [arguments...]
+
+=cut
+
+###############################################################################
+
+use strict;
+use Switch;
+use Env qw(
+ HOME PGHOST PGPORT PGUSER PGDATABASE MIGSCHEMA
+ MIGBASEWORKDIR MIGBASEGITDIR MIGGITDIR MIGWORKDIR
+);
+use Pod::Usage;
+use DBI;
+use Cwd 'abs_path';
+use FindBin;
+my $mig_bin = "$FindBin::Bin/";
+use lib "$FindBin::Bin/";
+use Mig;
+
+pod2usage(-verbose => 2) if defined $ARGV[0] && $ARGV[0] eq '--help';
+
+system(
+ 'psql',
+ # TODO inject mig-tracked variables here
+ @ARGV
+);
+
+exit 0;
+