X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FDeploymentHandler%2FVersionStorage%2FStandard.pm;h=45678127b52954b1a6acd13b845b389c094f8e9b;hb=f407579197b3d54de98e487bfa1a978c23aade6a;hp=961702308c11992e4ffa88a564791f490c3de6aa;hpb=b0bf9d6bb319880c42e98b8b07a65d315da5cbfd;p=dbsrgits%2FDBIx-Class-DeploymentHandler.git diff --git a/lib/DBIx/Class/DeploymentHandler/VersionStorage/Standard.pm b/lib/DBIx/Class/DeploymentHandler/VersionStorage/Standard.pm index 9617023..4567812 100644 --- a/lib/DBIx/Class/DeploymentHandler/VersionStorage/Standard.pm +++ b/lib/DBIx/Class/DeploymentHandler/VersionStorage/Standard.pm @@ -1,6 +1,15 @@ package DBIx::Class::DeploymentHandler::VersionStorage::Standard; use Moose; +use DBIx::Class::DeploymentHandler::Logger; +use Log::Contextual ':log', -default_logger => + DBIx::Class::DeploymentHandler::Logger->new({ + env_prefix => 'DBICDH' + }); + +# ABSTRACT: Version storage that does the normal stuff + use Method::Signatures::Simple; +use DBIx::Class::DeploymentHandler::VersionStorage::Standard::VersionResult; has schema => ( isa => 'DBIx::Class::Schema', @@ -11,7 +20,7 @@ has schema => ( has version_rs => ( isa => 'DBIx::Class::ResultSet', is => 'ro', - lazy_build => 1, + builder => '_build_version_rs', handles => [qw( database_version version_storage_is_installed )], ); @@ -25,31 +34,23 @@ sub _build_version_rs { $_[0]->schema->resultset('__VERSION') } -sub add_database_version { $_[0]->version_rs->create($_[1]) } +sub add_database_version { + my $version = $_[1]->{version}; + log_debug { "Adding database version $version" }; + $_[0]->version_rs->create($_[1]) +} sub delete_database_version { - $_[0]->version_rs->search({ version => $_[1]->{version}})->delete + my $version = $_[1]->{version}; + log_debug { "Deleting database version $version" }; + $_[0]->version_rs->search({ version => $version})->delete } __PACKAGE__->meta->make_immutable; 1; -__END__ - -=head1 THIS SUCKS +# vim: ts=2 sw=2 expandtab -You started your project and weren't using DBICDH? FOOL! Lucky for you I had -you in mind when I wrote this doc <3 - -First off, you'll want to just install the version_storage: - - my $s = My::Schema->connect(...); - my $dh = DeployHandler({ schema => $s }); - - $dh->prepare_version_storage_install; - $dh->install_version_storage; - -Then, bump your schema version, and you can use DBICDH like normal! +__END__ -vim: ts=2 sw=2 expandtab