X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FDeploymentHandler%2FVersionStorage%2FStandard.pm;h=cc79c4f85c13355cc1ff233d22aad035a54aced3;hb=6e9a733d577c24ac4fe4569515fbf94fecf40f5c;hp=78265aa8d7b98aae7a8fe950a1327d69dd941734;hpb=c9149a81c148dd7e846c23f12ede8b69a93836cb;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 78265aa..cc79c4f 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', -package_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,12 +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 { + my $version = $_[1]->{version}; + log_debug { "Deleting database version $version" }; + $_[0]->version_rs->search({ version => $version})->delete +} __PACKAGE__->meta->make_immutable; 1; +# vim: ts=2 sw=2 expandtab + __END__ -vim: ts=2 sw=2 expandtab