summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2018-01-16 21:26:59 +0100
committerIgor Scheller <igor.scheller@igorshp.de>2018-01-16 21:47:21 +0100
commit235266ec53f620d94a080ed7ae8e77eaef6dbb3c (patch)
treea252b862443a3551e761e09338e9bce3ce99c394 /bin
parente44ba8456130fcd0a282ea91b5736d903f8c0496 (diff)
Added basic database migration functionality
Diffstat (limited to 'bin')
-rwxr-xr-xbin/migrate21
1 files changed, 21 insertions, 0 deletions
diff --git a/bin/migrate b/bin/migrate
new file mode 100755
index 00000000..20ae2a93
--- /dev/null
+++ b/bin/migrate
@@ -0,0 +1,21 @@
+#!/usr/bin/env php
+<?php
+
+use Composer\Autoload\ClassLoader;
+use Engelsystem\Application;
+use Engelsystem\Database\Migration\Migrate;
+use Engelsystem\Database\Migration\MigrationServiceProvider;
+
+require_once __DIR__ . '/../includes/application.php';
+
+/** @var $loader ClassLoader */
+$baseDir = __DIR__ . '/../db/migrations';
+
+/** @var Application $app */
+$app = app();
+$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);