use FindBin;
use lib "$FindBin::Bin/";
my $mig_bin = "$FindBin::Bin/";
-use Mig;
+use EMig;
use strict;
use Switch;
use Cwd 'abs_path';
pod2usage(-verbose => 2) if defined $ARGV[0] && $ARGV[0] eq '--help';
-Mig::die_if_no_env_migschema();
+EMig::die_if_no_env_migschema();
die_if_gsheet_tracked_table_does_not_exist();
die_if_gsheet_tracked_column_does_not_exist();
my $sth;
my @ws;
my @tracked_ws_names;
-my $authfile = $ENV{HOME} . '/.mig/oauth.env';
+my $authfile = $ENV{HOME} . '/.emig/oauth.env';
my $next_arg_is_authfile;
foreach my $arg (@ARGV) {
if ($var1 eq 'CLIENTSECRET') { $clientsecret = $var2; }
if ($var1 eq 'SESSIONFILE') { $sessionfile = $var2; }
}
-my $dbh = Mig::db_connect();
+my $dbh = EMig::db_connect();
my $spreadsheet = connect_gsheet($clientid,$clientsecret,$sessionfile);
abort('could not connect to google sheet') unless (defined $spreadsheet);
my $table_name = shift;
my $schema_name = shift;
my @headers;
- my $dbh = Mig::db_connect();
+ my $dbh = EMig::db_connect();
$sql = 'SELECT column_name FROM information_schema.columns WHERE table_schema = ' . $dbh->quote( $schema_name ) . ' AND table_name = ' . $dbh->quote( $table_name ) . ';';
$sth = $dbh->prepare($sql);
$ra = $sth->execute();
}
sub check_for_gsheet_tracked_table {
- my $dbh = Mig::db_connect();
+ my $dbh = EMig::db_connect();
my $sth = $dbh->prepare("
SELECT EXISTS(
SELECT 1
|| die "Error checking for table (tracked_gsheet_table): $!";
my @cols = $sth->fetchrow_array;
$sth->finish;
- Mig::db_disconnect($dbh);
+ EMig::db_disconnect($dbh);
return $cols[0];
}
sub check_for_gsheet_tracked_column {
- my $dbh = Mig::db_connect();
+ my $dbh = EMig::db_connect();
my $sth = $dbh->prepare("
SELECT EXISTS(
SELECT 1
|| die "Error checking for table (gsheet_tracked_column): $!";
my @cols = $sth->fetchrow_array;
$sth->finish;
- Mig::db_disconnect($dbh);
+ EMig::db_disconnect($dbh);
return $cols[0];
}