-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
phalcon-migrations
50 lines (44 loc) · 1.51 KB
/
phalcon-migrations
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env php
<?php
/**
* This file is part of the Phalcon Developer Tools.
*
* (c) Phalcon Team <team@phalcon.io>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
use Phalcon\Cop\Parser;
use Phalcon\Db\Exception as DbException;
use Phalcon\Migrations\Console\Color;
use Phalcon\Migrations\Console\Commands\CommandsException;
use Phalcon\Migrations\Console\Commands\Migration;
use Phalcon\Migrations\Exception\RuntimeException;
try {
foreach ([__DIR__ . '/../../autoload.php', __DIR__ . '/../vendor/autoload.php', __DIR__ . '/vendor/autoload.php'] as $file) {
if (file_exists($file)) {
require $file;
break;
}
}
print PHP_EOL . Color::colorize('Phalcon Migrations', Color::FG_GREEN, Color::AT_BOLD) . PHP_EOL . PHP_EOL;
try {
$parser = new Parser();
$parser->parse();
$command = new Migration($parser);
$command->run();
} catch (CommandsException $commandsException) {
echo Color::error($commandsException->getMessage(), 'Exception Error: ');
exit(1);
} catch (RuntimeException $runtimeException) {
echo Color::error($runtimeException->getMessage(), 'Runtime Error: ');
exit(1);
} catch (DbException $dbException) {
echo Color::error($dbException->getMessage(), 'DB Error: ');
exit(1);
}
} catch (Throwable $e) {
echo Color::fatal($e->getMessage());
exit(1);
}