X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FDeploymentHandler%2FVersionStorage%2FStandard.pm;h=ca6a606500898d7dec2aa599e52d03b3102ed7d7;hb=0df68524a051e42f1a7f8606aee56e7c6b70b302;hp=4cf489f135b05c8bf3e37d04336d53bbcc73fde0;hpb=9af9d0b214683a715a55d69af1ab8bf5402ebe27;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 4cf489f..ca6a606 100644 --- a/lib/DBIx/Class/DeploymentHandler/VersionStorage/Standard.pm +++ b/lib/DBIx/Class/DeploymentHandler/VersionStorage/Standard.pm @@ -1,6 +1,14 @@ package DBIx::Class::DeploymentHandler::VersionStorage::Standard; use Moose; +use Log::Contextual::WarnLogger; +use Log::Contextual ':log', -default_logger => Log::Contextual::WarnLogger->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 +19,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,10 +33,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 { "[DBICDH] Adding database version $version" }; + $_[0]->version_rs->create($_[1]) +} + +sub delete_database_version { + my $version = $_[1]->{version}; + log_debug { "[DBICDH] 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