X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FDeploymentHandler%2FDad.pm;h=c5523f82a8887a107f94cc034c47eb7ec9d73290;hb=0df68524a051e42f1a7f8606aee56e7c6b70b302;hp=92bbb9337023eb83dadff79df67e186e11749025;hpb=be140a5f1f8ab40705bf4cbedb74761c4994a765;p=dbsrgits%2FDBIx-Class-DeploymentHandler.git diff --git a/lib/DBIx/Class/DeploymentHandler/Dad.pm b/lib/DBIx/Class/DeploymentHandler/Dad.pm index 92bbb93..c5523f8 100644 --- a/lib/DBIx/Class/DeploymentHandler/Dad.pm +++ b/lib/DBIx/Class/DeploymentHandler/Dad.pm @@ -6,6 +6,10 @@ use Moose; use Method::Signatures::Simple; require DBIx::Class::Schema; # loaded for type constraint use Carp::Clan '^DBIx::Class::DeploymentHandler'; +use Log::Contextual::WarnLogger; +use Log::Contextual ':log', -default_logger => Log::Contextual::WarnLogger->new({ + env_prefix => 'DBICDH' +}); has schema => ( isa => 'DBIx::Class::Schema', @@ -21,6 +25,7 @@ has backup_directory => ( has to_version => ( is => 'ro', + isa => 'Str', lazy_build => 1, ); @@ -28,12 +33,14 @@ sub _build_to_version { $_[0]->schema_version } has schema_version => ( is => 'ro', + isa => 'Str', lazy_build => 1, ); sub _build_schema_version { $_[0]->schema->schema_version } method install { + log_info { '[DBICDH] installing version ' . $self->to_version }; croak 'Install not possible as versions table already exists in database' if $self->version_storage_is_installed; @@ -46,6 +53,7 @@ method install { } sub upgrade { + log_info { '[DBICDH] upgrading' }; my $self = shift; while ( my $version_list = $self->next_version_set ) { my ($ddl, $upgrade_sql) = @{ @@ -61,6 +69,7 @@ sub upgrade { } sub downgrade { + log_info { '[DBICDH] upgrading' }; my $self = shift; while ( my $version_list = $self->previous_version_set ) { $self->downgrade_single_step({ version_set => $version_list }); @@ -70,7 +79,10 @@ sub downgrade { } } -method backup { $self->storage->backup($self->backup_directory) } +method backup { + log_info { '[DBICDH] backing up' }; + $self->storage->backup($self->backup_directory) +} __PACKAGE__->meta->make_immutable;