diff --git a/bin/developer b/bin/developer index 6326046041..713f2482f9 100755 --- a/bin/developer +++ b/bin/developer @@ -41,6 +41,13 @@ use Doctrine\ORM\Tools\Console\Command\GenerateProxiesCommand; use Doctrine\ORM\Tools\Console\Command\ConvertMappingCommand; use Doctrine\ORM\Tools\Console\Command\RunDqlCommand; use Doctrine\ORM\Tools\Console\Command\ValidateSchemaCommand; +// Migration Commands +use Doctrine\DBAL\Migrations\Tools\Console\Command\DiffCommand; +use Doctrine\DBAL\Migrations\Tools\Console\Command\ExecuteCommand; +use\Doctrine\DBAL\Migrations\Tools\Console\Command\GenerateCommand; +use Doctrine\DBAL\Migrations\Tools\Console\Command\MigrateCommand; +use Doctrine\DBAL\Migrations\Tools\Console\Command\StatusCommand; +use Doctrine\DBAL\Migrations\Tools\Console\Command\VersionCommand; require_once __DIR__ . '/../lib/autoload.php'; @@ -99,6 +106,13 @@ $cli['console']->addCommands([ new ConvertMappingCommand(), new RunDqlCommand(), new ValidateSchemaCommand(), + // Migrations Commands + new DiffCommand(), + new ExecuteCommand(), + new GenerateCommand(), + new MigrateCommand(), + new StatusCommand(), + new VersionCommand(), ]); exit($cli->runCLI()); diff --git a/cli-config.php b/cli-config.php deleted file mode 100644 index 88fb969508..0000000000 --- a/cli-config.php +++ /dev/null @@ -1,17 +0,0 @@ - new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($app['EM']->getConnection()), - 'em' => new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($app['EM']) -)); diff --git a/composer.json b/composer.json index 466eaef7af..842e832996 100644 --- a/composer.json +++ b/composer.json @@ -42,7 +42,8 @@ "twig/twig" : "~1.14, >=1.14.2", "twig/extensions" : "~1.0", "vierbergenlars/php-semver" : "~2.1", - "zend/gdata" : "~1.12.1" + "zend/gdata" : "~1.12.1", + "doctrine/migrations" : "1.0.x-dev@dev" }, "require-dev": { "doctrine/data-fixtures" : "1.0.x@dev", @@ -53,8 +54,7 @@ "behat/mink-extension" : "~1.0", "behat/mink-goutte-driver" : "~1.0", "behat/mink-selenium2-driver" : "~1.0", - "fabpot/goutte" : "~1.0", - "doctrine/migrations" : "1.0.*@dev" + "fabpot/goutte" : "~1.0" }, "repositories": [ { diff --git a/composer.lock b/composer.lock index 88af5a5f60..7f2d58438b 100644 --- a/composer.lock +++ b/composer.lock @@ -3,7 +3,7 @@ "This file locks the dependencies of your project to a known state", "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file" ], - "hash": "71eadbedd0128a36df83b31412e86ece", + "hash": "989a79784be4adcf2393615316d5fdd2", "packages": [ { "name": "alchemy-fr/tcpdf-clone", @@ -899,6 +899,66 @@ ], "time": "2013-01-12 18:59:04" }, + { + "name": "doctrine/migrations", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/doctrine/migrations.git", + "reference": "37aacdae6507faad03c3df1624e7d3a6e6c1b388" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/migrations/zipball/37aacdae6507faad03c3df1624e7d3a6e6c1b388", + "reference": "37aacdae6507faad03c3df1624e7d3a6e6c1b388", + "shasum": "" + }, + "require": { + "doctrine/dbal": "~2.0", + "php": ">=5.3.2" + }, + "require-dev": { + "symfony/console": "2.*", + "symfony/yaml": "2.*" + }, + "suggest": { + "symfony/console": "to run the migration from the console" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\DBAL\\Migrations": "lib" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL" + ], + "authors": [ + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com", + "homepage": "http://www.jwage.com/", + "role": "Creator" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + } + ], + "description": "Database Schema migrations using Doctrine DBAL", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "database", + "migrations" + ], + "time": "2013-11-10 05:33:50" + }, { "name": "doctrine/orm", "version": "v2.4.1", @@ -2830,12 +2890,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/symfony.git", - "reference": "b76ac2f865bae2e2ca87302935f5d9a458f1401f" + "reference": "587f35513761547e43c4538e44df485f62fcd92e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/symfony/zipball/b76ac2f865bae2e2ca87302935f5d9a458f1401f", - "reference": "b76ac2f865bae2e2ca87302935f5d9a458f1401f", + "url": "https://api.github.com/repos/symfony/symfony/zipball/587f35513761547e43c4538e44df485f62fcd92e", + "reference": "587f35513761547e43c4538e44df485f62fcd92e", "shasum": "" }, "require": { @@ -2935,7 +2995,7 @@ "keywords": [ "framework" ], - "time": "2013-11-09 16:01:15" + "time": "2013-11-13 21:30:16" }, { "name": "themattharris/tmhoauth", @@ -3618,66 +3678,6 @@ ], "time": "2013-10-16 14:26:38" }, - { - "name": "doctrine/migrations", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/doctrine/migrations.git", - "reference": "37aacdae6507faad03c3df1624e7d3a6e6c1b388" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/migrations/zipball/37aacdae6507faad03c3df1624e7d3a6e6c1b388", - "reference": "37aacdae6507faad03c3df1624e7d3a6e6c1b388", - "shasum": "" - }, - "require": { - "doctrine/dbal": "~2.0", - "php": ">=5.3.2" - }, - "require-dev": { - "symfony/console": "2.*", - "symfony/yaml": "2.*" - }, - "suggest": { - "symfony/console": "to run the migration from the console" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-0": { - "Doctrine\\DBAL\\Migrations": "lib" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "LGPL" - ], - "authors": [ - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com", - "homepage": "http://www.jwage.com/", - "role": "Creator" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - } - ], - "description": "Database Schema migrations using Doctrine DBAL", - "homepage": "http://www.doctrine-project.org", - "keywords": [ - "database", - "migrations" - ], - "time": "2013-11-10 05:33:50" - }, { "name": "fabpot/goutte", "version": "v1.0.3", @@ -4168,10 +4168,10 @@ "imagine/imagine": 20, "silex/silex": 20, "symfony/symfony": 20, + "doctrine/migrations": 20, "doctrine/data-fixtures": 20, "behat/behat": 20, - "behat/gherkin": 20, - "doctrine/migrations": 20 + "behat/gherkin": 20 }, "platform": { "php": ">=5.3.3" diff --git a/lib/Alchemy/Phrasea/Core/CLIProvider/DoctrineMigrationServiceProvider.php b/lib/Alchemy/Phrasea/Core/CLIProvider/DoctrineMigrationServiceProvider.php index 7774717aba..1edee6f075 100644 --- a/lib/Alchemy/Phrasea/Core/CLIProvider/DoctrineMigrationServiceProvider.php +++ b/lib/Alchemy/Phrasea/Core/CLIProvider/DoctrineMigrationServiceProvider.php @@ -21,8 +21,8 @@ class DoctrineMigrationServiceProvider implements ServiceProviderInterface { $app['doctrine-migration.configuration'] = $app->share(function ($app) { $configuration = new YamlConfiguration($app['EM']->getConnection()); - $configuration->load(sprintf('%s/lib/conf.d/migrations.yml', $app['root.path'])); - $configuration->setMigrationsDirectory(sprintf('%s/lib/Alchemy/Phrasea/Setup/DoctrineMigration', $app['root.path'])); + $configuration->load(__DIR__.'/../../../../conf.d/migrations.yml'); + $configuration->setMigrationsDirectory(__DIR__.'/../../../../Alchemy/Phrasea/Setup/DoctrineMigration'); return $configuration; }); diff --git a/lib/classes/module/console/systemUpgrade.php b/lib/classes/module/console/systemUpgrade.php index fabe3bb7de..d4ba3a18df 100644 --- a/lib/classes/module/console/systemUpgrade.php +++ b/lib/classes/module/console/systemUpgrade.php @@ -68,15 +68,11 @@ class module_console_systemUpgrade extends Command try { $upgrader = new Setup_Upgrade($this->container, $input->getOption('force')); - $queries = $this->getService('phraseanet.appbox')->forceUpgrade($upgrader, $this->container); } catch (\Exception_Setup_FixBadEmailAddresses $e) { return $output->writeln(sprintf('You have to fix your database before upgrade with the system:mailCheck command ')); - } catch (\Exception $e) { - $output->write(''.$e->getMessage().'', true); - var_dump($e->getTraceAsString()); } - + $queries = $this->getService('phraseanet.appbox')->forceUpgrade($upgrader, $this->container); if ($input->getOption('dump')) { if (0 < count($queries)) { diff --git a/lib/classes/patch/381alpha3a.php b/lib/classes/patch/381alpha3a.php index 26fcc42673..64ca72ba69 100644 --- a/lib/classes/patch/381alpha3a.php +++ b/lib/classes/patch/381alpha3a.php @@ -27,6 +27,14 @@ class patch_381alpha3a implements patchInterface return $this->release; } + /** + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array(); + } + /** * {@inheritdoc} */ diff --git a/lib/classes/patch/381alpha4a.php b/lib/classes/patch/381alpha4a.php index 157c965829..280b7e8fa2 100644 --- a/lib/classes/patch/381alpha4a.php +++ b/lib/classes/patch/381alpha4a.php @@ -27,6 +27,14 @@ class patch_381alpha4a implements patchInterface return $this->release; } + /** + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array(); + } + /** * {@inheritdoc} */ diff --git a/tests/Alchemy/Tests/Phrasea/Core/CLIProvider/DoctrineMigrationServiceProviderTest.php b/tests/Alchemy/Tests/Phrasea/Core/CLIProvider/DoctrineMigrationServiceProviderTest.php index 03cb45949a..96289f696b 100644 --- a/tests/Alchemy/Tests/Phrasea/Core/CLIProvider/DoctrineMigrationServiceProviderTest.php +++ b/tests/Alchemy/Tests/Phrasea/Core/CLIProvider/DoctrineMigrationServiceProviderTest.php @@ -8,7 +8,7 @@ class DoctrineMigrationServiceProviderTest extends ServiceProviderTestCase { return array( array( - 'Alchemy\Phrasea\Core\CLIProvider\ DoctrineMigrationServiceProvider', + 'Alchemy\Phrasea\Core\CLIProvider\DoctrineMigrationServiceProvider', 'doctrine-migration.configuration', 'Doctrine\DBAL\Migrations\Configuration\YamlConfiguration' )