X-Git-Url: http://git.equinoxoli.org/?p=migration-tools.git;a=blobdiff_plain;f=kmig;h=7feddb9f77f0d75f7ed12e8968e0de901f0a44b9;hp=3d53a6c8cc7c917601665404aee30eec8fe9c6c6;hb=6a91d9cb80bcb7c572fb5c25436e4e067317bdd8;hpb=1bce989307b3c3454679f0c0e6a7c79037d9dbfd diff --git a/kmig b/kmig index 3d53a6c..7feddb9 100755 --- a/kmig +++ b/kmig @@ -5,7 +5,8 @@ =head1 NAME mig - git-like program for tracking and manipulating legacy data files for -migrations +migrations. This variant of and is geared toward the Koha ILS and +MySql/MariaDB. =head1 SYNOPSIS @@ -15,20 +16,14 @@ B [argument] [...] B is used to track and manipulate CSV or CSV-like text files exported from legacy systems for migration into Evergreen. It can be a wrapper for some -other migration tools and tracks state using a PostgreSQL table in a given -migration schema. - -It makes use of certain environment variables that may be set by the B -tool: PGHOST, PGPORT, PGUSER, PGDATABASE, MIGSCHEMA, and MIGWORKDIR +other migration tools and tracks state using a MySQL table for a given +database. For most commands, if the current working directory falls outside of the directory specified by MIGWORKDIR, then mig will assume that environment is also incorrect and bail before doing any actual work. -~/.pgpass should also be configured, as B will not prompt for a database -password. - -Only the B and B commands work without the MIGSCHEMA environment +Only the B and B commands work without the MIGDATABASE environment variable being set. =head1 OVERVIEW @@ -41,7 +36,7 @@ Using B should go something like this: =item mig env use m_foo # Spawns a shell using the configured environment -=item mig init # creates the m_foo schema in the database if needed, and other tables +=item mig init # creates any needed auxilary tables =item mig add patrons.tsv # tracks an incoming data file; repeat for additional files @@ -49,7 +44,7 @@ Using B should go something like this: =item mig clean patrons.tsv # cleans the file, creating patrons.tsv.utf8.clean -=item mig link patrons.tsv actor_usr # makes the soon-to-be staging table a child of m_foo.actor_usr +=item mig link patrons.tsv borrowers # models the soon-to-be staging table after table 'borrowers' =item mig convert patrons.tsv # creates a .sql file for staging the data @@ -89,7 +84,7 @@ some directory creation and symlinking. =item B Create or re-create the PostgreSQL tracking table for the schema specified by -the MIGSCHEMA environment variable. If needed, create the migration schema +the MIGDATABASE environment variable. If needed, create the migration schema itself and run migration_tools.init() and build() if the migration_tools schema exists. @@ -184,7 +179,7 @@ If given no other arguments, the invocation will lool like =over 5 -csv2sql --config scripts/clean.conf --add-x-migrate --schema [--parent ] -o <[.utf8.clean.stage.sql]|[parent_table_stage.sql]> .utf8.clean +csv2sql --config scripts/clean.conf --add-x-migrate --schema [--parent ] -o <[.utf8.clean.stage.sql]|[parent_table_stage.sql]> .utf8.clean =back @@ -215,7 +210,7 @@ The files will have \include hooks for pulling in additional mapping files =item B [file] -Writes a MIGSCHEMA.tsv file containing a break-down of mapped and flagged +Writes a MIGDATABASE.tsv file containing a break-down of mapped and flagged fields from the specified file, or all staged files if no file is specified. The main goal of the tsv file is to present end-user mappable data for circ @@ -246,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 mig git directory. +adds an extra arbitrary page of notes to the report. KMig assumes the page file is in the mig git directory. --tags @@ -278,14 +273,14 @@ table. An oauth session key is also needed for your Google account and mig gshe use strict; use Switch; use Env qw( - HOME PGHOST PGPORT PGUSER PGDATABASE MIGSCHEMA + HOME PGHOST PGPORT PGUSER PGDATABASE MIGDATABASE MIGBASEWORKDIR MIGBASEGITDIR MIGGITDIR MIGWORKDIR ); use Pod::Usage; use FindBin; -my $mig_bin = "$FindBin::Bin/mig-bin/"; -use lib "$FindBin::Bin/mig-bin"; -use Mig; +my $mig_bin = "$FindBin::Bin/kmig.d/bin/"; +use lib "$FindBin::Bin/kmig.d/bin"; +use KMig; pod2usage(-verbose => 2) if ! $ARGV[0]; switch($ARGV[0]) { @@ -322,13 +317,12 @@ 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 . "mig-$cmd") { system( $mig_bin . "mig-$cmd", @_ ); } else { system( "mig-$cmd", @_ ) == 0 or die pod2usage(1); } - }