summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2018-08-30 16:07:50 +0200
committerIgor Scheller <igor.scheller@igorshp.de>2018-08-30 16:07:50 +0200
commit2bebbeb1919e1d370ac5c0668e0db5ea63e73292 (patch)
tree759d675b621eed86b20f14abe448e83fa8d22562 /bin
parent175c335810817ff3e989f368889274d3f09c08b1 (diff)
Installation: Added migrations for install.sql and update.sql files
Diffstat (limited to 'bin')
-rwxr-xr-xbin/migrate19
1 files changed, 18 insertions, 1 deletions
diff --git a/bin/migrate b/bin/migrate
index 20ae2a93..ab3598d4 100755
--- a/bin/migrate
+++ b/bin/migrate
@@ -18,4 +18,21 @@ $app->register(MigrationServiceProvider::class);
/** @var Migrate $migration */
$migration = $app->get('db.migration');
$migration->setOutput(function ($text) { echo $text . PHP_EOL; });
-$migration->run($baseDir, Migrate::UP);
+
+if (isset($argv[1]) && strtolower($argv[1]) == 'help') {
+ echo PHP_EOL . 'Usage: ' . $argv[1] . ' [up|down] [one-step]' . PHP_EOL . PHP_EOL;
+ exit;
+}
+
+$method = Migrate::UP;
+if (isset($argv[1]) && strtolower($argv[1]) == 'down') {
+ $argv = array_values($argv);
+ $method = Migrate::DOWN;
+}
+
+$oneStep = false;
+if (isset($argv[2]) && strtolower($argv[2]) == 'one-step') {
+ $oneStep = true;
+}
+
+$migration->run($baseDir, $method, $oneStep);