diff --git a/composer.json b/composer.json
index 4b45366..9799b7c 100644
--- a/composer.json
+++ b/composer.json
@@ -16,8 +16,8 @@
}],
"require": {
"php": ">=5.3.2",
- "symfony/console": "^2.0||^3.0||^4.0",
- "symfony/config": "^2.0||^3.0||^4.0"
+ "symfony/console": "^2.0||^3.0||^4.0||^5.0",
+ "symfony/config": "^2.0||^3.0||^4.0||^5.0"
},
"require-dev": {
"phpunit/phpunit": "3.*",
diff --git a/src/Phpmig/Console/Command/DownCommand.php b/src/Phpmig/Console/Command/DownCommand.php
index a9f8164..72d1c08 100644
--- a/src/Phpmig/Console/Command/DownCommand.php
+++ b/src/Phpmig/Console/Command/DownCommand.php
@@ -58,15 +58,17 @@ protected function execute(InputInterface $input, OutputInterface $output)
$version = $input->getArgument('version');
if (!in_array($version, $versions)) {
- return;
+ return 0;
}
if (!isset($migrations[$version])) {
- return;
+ return 0;
}
$container = $this->getContainer();
$container['phpmig.migrator']->down($migrations[$version]);
+
+ return 0;
}
}
diff --git a/src/Phpmig/Console/Command/GenerateCommand.php b/src/Phpmig/Console/Command/GenerateCommand.php
index de415d9..3ead1b2 100644
--- a/src/Phpmig/Console/Command/GenerateCommand.php
+++ b/src/Phpmig/Console/Command/GenerateCommand.php
@@ -153,7 +153,7 @@ public function down()
'.' . str_replace(getcwd(), '', $path)
);
- return;
+ return 0;
}
protected function transMigName($migrationName)
diff --git a/src/Phpmig/Console/Command/MigrateCommand.php b/src/Phpmig/Console/Command/MigrateCommand.php
index 8757842..9db8874 100644
--- a/src/Phpmig/Console/Command/MigrateCommand.php
+++ b/src/Phpmig/Console/Command/MigrateCommand.php
@@ -112,5 +112,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$container['phpmig.migrator']->up($migration);
}
}
+
+ return 0;
}
}
diff --git a/src/Phpmig/Console/Command/RedoCommand.php b/src/Phpmig/Console/Command/RedoCommand.php
index e267ffe..a1f0118 100644
--- a/src/Phpmig/Console/Command/RedoCommand.php
+++ b/src/Phpmig/Console/Command/RedoCommand.php
@@ -58,16 +58,18 @@ protected function execute(InputInterface $input, OutputInterface $output)
$version = $input->getArgument('version');
if (!in_array($version, $versions)) {
- return;
+ return 0;
}
if (!isset($migrations[$version])) {
- return;
+ return 0;
}
$container = $this->getContainer();
$container['phpmig.migrator']->down($migrations[$version]);
$container['phpmig.migrator']->up($migrations[$version]);
+
+ return 0;
}
}
diff --git a/src/Phpmig/Console/Command/RollbackCommand.php b/src/Phpmig/Console/Command/RollbackCommand.php
index da8b2ca..878aa9a 100644
--- a/src/Phpmig/Console/Command/RollbackCommand.php
+++ b/src/Phpmig/Console/Command/RollbackCommand.php
@@ -55,7 +55,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$migrations = $this->getMigrations();
$versions = $this->getAdapter()->fetchAll();
-
+
$version = $input->getOption('target');
ksort($migrations);
@@ -64,9 +64,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
// Check we have at least 1 migration to revert
if (empty($versions) || $version == end($versions)) {
$output->writeln("No migrations to rollback");
- return;
+ return 0;
}
-
+
// If no target version was supplied, revert the last migration
if (null === $version) {
// Get the migration before the last run migration
@@ -75,17 +75,17 @@ protected function execute(InputInterface $input, OutputInterface $output)
} else {
// Get the first migration number
$first = reset($versions);
-
+
// If the target version is before the first migration, revert all migrations
if ($version < $first) {
$version = 0;
}
}
-
+
// Check the target version exists
if (0 !== $version && !isset($migrations[$version])) {
$output->writeln("Target version ($version) not found");
- return;
+ return 0;
}
// Revert the migration(s)
@@ -100,5 +100,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$container['phpmig.migrator']->down($migration);
}
}
+
+ return 0;
}
}
diff --git a/src/Phpmig/Console/Command/StatusCommand.php b/src/Phpmig/Console/Command/StatusCommand.php
index 8dc38f9..3e46f52 100644
--- a/src/Phpmig/Console/Command/StatusCommand.php
+++ b/src/Phpmig/Console/Command/StatusCommand.php
@@ -54,7 +54,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$versions = $this->getAdapter()->fetchAll();
foreach($this->getMigrations() as $migration) {
-
+
if (in_array($migration->getVersion(), $versions)) {
$status = " up ";
unset($versions[array_search($migration->getVersion(), $versions)]);
@@ -63,23 +63,23 @@ protected function execute(InputInterface $input, OutputInterface $output)
}
$output->writeln(
- $status .
- sprintf(" %14s ", $migration->getVersion()) .
+ $status .
+ sprintf(" %14s ", $migration->getVersion()) .
" " . $migration->getName() . ""
);
}
foreach($versions as $missing) {
$output->writeln(
- ' up ' .
- sprintf(" %14s ", $missing) .
+ ' up ' .
+ sprintf(" %14s ", $missing) .
' ** MISSING ** '
);
}
// print status
$output->writeln("");
- return;
+ return 0;
}
}
diff --git a/src/Phpmig/Console/Command/UpCommand.php b/src/Phpmig/Console/Command/UpCommand.php
index ee6ed8a..8931ce2 100644
--- a/src/Phpmig/Console/Command/UpCommand.php
+++ b/src/Phpmig/Console/Command/UpCommand.php
@@ -58,15 +58,17 @@ protected function execute(InputInterface $input, OutputInterface $output)
$version = $input->getArgument('version');
if (in_array($version, $versions)) {
- return;
+ return 0;
}
if (!isset($migrations[$version])) {
- return;
+ return 0;
}
$container = $this->getContainer();
$container['phpmig.migrator']->up($migrations[$version]);
+
+ return 0;
}
}