12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <?php
- use Doctrine\ORM\Tools\Console\ConsoleRunner;
- use Symfony\Component\Console\Helper\HelperSet;
- use Doctrine\DBAL\Types\Type;
- (@include_once __DIR__.'/../vendor/autoload.php') || @include_once __DIR__.'/../../../autoload.php';
- $directories = array(getcwd(), getcwd().DIRECTORY_SEPARATOR.'config');
- $configFile = null;
- foreach ($directories as $directory) {
- $configFile = $directory.DIRECTORY_SEPARATOR.'cli-config.php';
- if (file_exists($configFile)) {
- break;
- }
- }
- if (!file_exists($configFile)) {
- ConsoleRunner::printCliConfigTemplate();
- exit(1);
- }
- if (!is_readable($configFile)) {
- echo 'Configuration file ['.$configFile.'] does not have read permission.'."\n";
- exit(1);
- }
- Type::overrideType(
- Type::DATETIME,
- Database::getUTCDateTimeTypeClass()
- );
- $commands = array(
- new \Doctrine\DBAL\Migrations\Tools\Console\Command\DiffCommand(),
- new \Doctrine\DBAL\Migrations\Tools\Console\Command\ExecuteCommand(),
- new \Doctrine\DBAL\Migrations\Tools\Console\Command\GenerateCommand(),
- new \Doctrine\DBAL\Migrations\Tools\Console\Command\LatestCommand(),
- new \Doctrine\DBAL\Migrations\Tools\Console\Command\MigrateCommand(),
- new \Doctrine\DBAL\Migrations\Tools\Console\Command\StatusCommand(),
- new \Doctrine\DBAL\Migrations\Tools\Console\Command\VersionCommand()
- );
- $helperSet = require $configFile;
- if (!($helperSet instanceof HelperSet)) {
- foreach ($GLOBALS as $helperSetCandidate) {
- if ($helperSetCandidate instanceof HelperSet) {
- $helperSet = $helperSetCandidate;
- break;
- }
- }
- }
- \Doctrine\ORM\Tools\Console\ConsoleRunner::run($helperSet, $commands);
|