-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcli
28 lines (22 loc) · 1022 Bytes
/
cli
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
use Symfony\Component\Console;
use Doctrine\DBAL\Migrations\MigrationsVersion;
use Doctrine\DBAL\Migrations\Tools\Console\Command as MigrationsCommand;
require (__DIR__ . '/vendor/autoload.php');
$cli = new Console\Application('Doctrine Migrations', MigrationsVersion::VERSION());
$cli->setCatchExceptions(true);
$db = \Doctrine\DBAL\DriverManager::getConnection(config('database.connections.mysql'));
$helperSet = new \Symfony\Component\Console\Helper\HelperSet([
'db' => new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($db),
'dialog' => new Console\Helper\QuestionHelper()
]);
$cli->setHelperSet($helperSet);
$commands = [];
$commands[] = new MigrationsCommand\ExecuteCommand();
$commands[] = new MigrationsCommand\GenerateCommand();
$commands[] = new MigrationsCommand\LatestCommand();
$commands[] = new MigrationsCommand\MigrateCommand();
$commands[] = new MigrationsCommand\StatusCommand();
$commands[] = new MigrationsCommand\VersionCommand();
$cli->addCommands($commands);
$cli->run();