The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

PGObject::Util::DBChange - Track applied change files in the database

VERSION

Version 0.050.4

SYNOPSIS

Quick summary of what the module does.

Perhaps a little code snippet.

    use PGObject::Util::DBChange;

    my $foo = PGObject::Util::DBChange->new();
    ...

PROPERTIES

path

Path to load content from -- Must be defined and '' or a string

no_transactions

If true, we assume success even if transaction fails

Future versions may add additional checking possibilies instead

content

Content of the file. Can be specified at load, or is built by reading from the file.

succeeded (rwp)

Undefined until run. After run, 1 if success, 0 if failure.

dependencies

A list of other changes to apply first. If strings are provided, these are turned into path objects.

Currently these must be explicitly provided. Future bersions may read these from comments in the files themselves.

sha

The sha hash of the normalized content (comments and whitespace lines stripped) of the file.

begin_txn

Code to begin transaction, defaults to 'BEGIN;'

commit_txn

Code to commit transaction, defaults to 'COMMIT;'

Useful if one needs to do two phase commit or similar

METHODS

content_wrapped($before, $after)

Returns content wrapped with before and after.

is_applied($dbh)

returns 1 if has already been applied, false if not

run($dbh)

Runs against the current dbh without tracking.

apply($dbh)

Applies the current file to the db in the current dbh.

Functions (package-level)

needs_init($dbh)

Checks to see whether the schema has been initialized

init($dbh);

Initializes the system. Modifications are maintained through the History module. Returns 0 if was up to date, 1 if was initialized.

update($dbh)

Updates the current schema to the most recent.

AUTHOR

Chris Travers, <chris.travers at gmail.com>

BUGS

Please report any bugs or feature requests to bug-pgobject-util-dbchange at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=PGObject-Util-DBChange. 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 PGObject::Util::DBChange

You can also look for information at:

ACKNOWLEDGEMENTS

Portions of this code were developed for LedgerSMB 1.5 and copied from appropriate sources there.

Many thanks to Sedex Global for their sponsorship of portions of the module.

LICENSE AND COPYRIGHT

Copyright 2016, 2017 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 LedgerSMB 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.