sub upgrade {
log_info { '[DBICDH] upgrading' };
my $self = shift;
+ my $ran_once = 0;
while ( my $version_list = $self->next_version_set ) {
+ $ran_once = 1;
my ($ddl, $upgrade_sql) = @{
$self->upgrade_single_step({ version_set => $version_list })
||[]};
upgrade_sql => $upgrade_sql,
});
}
+
+ log_warn { '[DBICDH] no need to run upgrade' } unless $ran_once;
}
sub downgrade {
log_info { '[DBICDH] upgrading' };
my $self = shift;
+ my $ran_once = 0;
while ( my $version_list = $self->previous_version_set ) {
+ $ran_once = 1;
$self->downgrade_single_step({ version_set => $version_list });
# do we just delete a row here? I think so but not sure
$self->delete_database_version({ version => $version_list->[-1] });
}
+ log_warn { '[DBICDH] no version to run downgrade' } unless $ran_once;
}
method backup {
--- /dev/null
+package DBIx::Class::DeploymentHandler::Logger;
+
+use warnings;
+use strict;
+
+use parent 'Log::Contextual::WarnLogger';
+
+# trace works the way we want it already
+
+# sub is_trace { $_[0]->next::method }
+sub is_debug { $_[0]->is_trace || $_[0]->next::method }
+sub is_info { $_[0]->is_debug || $_[0]->next::method }
+
+sub is_warn {
+ my $orig = $_[0]->next::method;
+ return undef if defined $orig && !$orig;
+ return $_[0]->is_info || 1
+}
+
+sub is_error {
+ my $orig = $_[0]->next::method;
+ return undef if defined $orig && !$orig;
+ return $_[0]->is_warn || 1
+}
+
+sub is_fatal {
+ my $orig = $_[0]->next::method;
+ return undef if defined $orig && !$orig;
+ return $_[0]->is_error || 1
+}
+
+1;