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

NAME

SQL::DBx::Deploy - Deployment support for SQL::DB

VERSION

0.971.0. Development release.

SYNOPSIS

    use SQL::DB;
    use SQL::DBx::Deploy;

    my $db = SQL::DB->connect('dbi:SQLite:dbname=test');

    $db->deploy($arrayref);
    $db->deploy_file('statements.sql');
    $db->deploy_dir('/location');

DESCRIPTION

SQL::DBx::Deploy adds very simple forward-only (re-)deployment support to SQL::DB. The approach is extremely simple, based on the number of statements already executed. SQL::DBx::Deploy keeps track of what has been run through a table in your database called '_deploy'.

You should only ever add new statements to your sources!

METHODS

run_file($file, [$app])

Runs the contents of $file (which must end in .sql or .pl) against the database.

run_dir($directory, [$app])

Runs the SQL *.sql or Perl *.pl files found in $directory against the database.

last_deploy_id( [$app] )

Returns the count of all deployment statements for application $app (or 'default') that have already been deployed.

deploy($arrayref, [$app])

Deploys the statements in $arrayref which have not already been deployed for application $app (if given, 'default' otherwise). $arrayref is an array of hashrefs containing a single key/value pair. The key must be either sql or pl. Returns a two item list: the first value is the old deploy ID, the second value is the new deploy id.

deploy_file($file, [$app])

Deploys the contents of $file (which must end in .sql or .pl) using deploy().

deploy_dir($directory, [$app])

Loads the SQL *.sql or Perl *.pl files found in $directory and deploys them using deploy().

deployed_table_info([ $schema ])

Returns a structure which you can save (any way you like) and use as the table_info parameter to the new method of SQL::DB.

SEE ALSO

SQL::DB, Moo::Role

AUTHOR

Mark Lawrence <nomad@null.net>

COPYRIGHT AND LICENSE

Copyright (C) 2011 Mark Lawrence <nomad@null.net>

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.