summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2019-04-13 17:17:44 +0200
committerDaniel Friesel <derf@finalrewind.org>2019-04-13 17:17:44 +0200
commit4d413d06a37c0cefd1d99d38b10bcdf7b506d538 (patch)
tree62f7e4e4009d12ce15e5bac3bbe6c8517f7720ed /lib
parentee53b8f37e8b87ae27bd04086f9a1c04922af33e (diff)
"database" sub-command: Provide an exit status
Diffstat (limited to 'lib')
-rw-r--r--lib/Travelynx/Command/database.pm5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Travelynx/Command/database.pm b/lib/Travelynx/Command/database.pm
index a42d378..5e1b38a 100644
--- a/lib/Travelynx/Command/database.pm
+++ b/lib/Travelynx/Command/database.pm
@@ -110,6 +110,7 @@ my @migrations = (
sub run {
my ( $self, $command ) = @_;
+ my $exit_status = 0;
my $dbh = $self->app->dbh;
@@ -120,6 +121,7 @@ sub run {
}
else {
$dbh->rollback;
+ $exit_status = 1;
}
}
elsif ( $command eq 'migrate' ) {
@@ -134,6 +136,7 @@ sub run {
if ( not $migrations[$i]($dbh) ) {
say "Aborting migration; rollback to v${schema_version}";
$dbh->rollback;
+ $exit_status = 1;
last;
}
}
@@ -147,6 +150,7 @@ sub run {
}
else {
say "no";
+ $exit_status = 1;
}
}
else {
@@ -155,6 +159,7 @@ sub run {
$dbh->disconnect;
+ exit($exit_status);
}
1;