NAME

App::PGMultiDeploy - OO deployment to multiple dbs for Pg

VERSION

Version 0.004

SYNOPSIS

This package provides a library and a command line utility to run sql scripts on multiple pg databases relying on two phase commit to ensure the script succeeds or fails. Scripts can only be applied once and the intended use is to manage schema changes over time in databases subject to row-level logical replication.

Features:

Recovery for partial application

A change file is not re-applied if it has been applied before unless the file has changed. This means if another system using PGObject::Util::DBChange applies a file to one db, you can still safely use it here.

Two phase commit

A change file either commits or rolls back on every database in a group

Reuse of libpq tooling

.pgpass etc files work with this tool

Logging of failures in separate transaction

Use as a library:

use App::PGMultiDeploy;

my $foo = App::PGMultiDeploy->new( config_file => 'path/to/conf.ini',
                                   change_file => 'path/to/change.sql',
                                   dbgroup => 'defined_in_config');
$foo->deploy;

use as a commandline:

pg_multideploy --config=/path/to/conf.ini --sql=mychanges.sql --dbgroup=foo

PROPERTIES

config_file (--config)

The ini file defining the environment configuration

config (lazily loaded from config file)

dbgroup (--dbgroup)

change_file (--sql)

Path to db change

config

The configuration object loaded from the config file

dbchange

The db change object, loaded from file

SUBROUTINES/METHODS

deploy

AUTHOR

Chris Travers, <chris at efficito.com>

BUGS

Please report any bugs or feature requests to bug-app-pgmultideploy at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=App-PGMultiDeploy. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc App::PGMultiDeploy

You can also look for information at:

ACKNOWLEDGEMENTS

Many thanks to Sedex Global for funding the initial version of this tool.

LICENSE AND COPYRIGHT

Copyright 2016 Chris Travers.

This program is distributed under the (Revised) BSD License: http://www.opensource.org/licenses/BSD-3-Clause

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

* Neither the name of Chris Travers's Organization nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.