summaryrefslogtreecommitdiff
path: root/bin/migrate
diff options
context:
space:
mode:
Diffstat (limited to 'bin/migrate')
-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);