2011-02-02 02:06:38 +01:00
|
|
|
<?php
|
|
|
|
|
2011-08-30 23:29:49 +02:00
|
|
|
/**
|
|
|
|
* This file is part of the PropelBundle package.
|
|
|
|
* For the full copyright and license information, please view the LICENSE
|
|
|
|
* file that was distributed with this source code.
|
|
|
|
*
|
|
|
|
* @license MIT License
|
|
|
|
*/
|
|
|
|
|
2011-02-14 22:31:28 +01:00
|
|
|
namespace Propel\PropelBundle\Command;
|
2011-02-02 02:06:38 +01:00
|
|
|
|
2011-09-05 22:18:18 +02:00
|
|
|
use Propel\PropelBundle\Command\AbstractPropelCommand;
|
2011-02-02 02:06:38 +01:00
|
|
|
use Symfony\Component\Console\Input\InputInterface;
|
|
|
|
use Symfony\Component\Console\Output\OutputInterface;
|
|
|
|
|
|
|
|
/**
|
2011-02-02 02:31:12 +01:00
|
|
|
* MigrationGenerateDiffCommand.
|
2011-02-02 02:06:38 +01:00
|
|
|
*
|
2011-04-19 14:23:17 +02:00
|
|
|
* @author William DURAND <william.durand1@gmail.com>
|
2011-02-02 02:06:38 +01:00
|
|
|
*/
|
2011-09-05 22:18:18 +02:00
|
|
|
class MigrationGenerateDiffCommand extends AbstractPropelCommand
|
2011-02-02 02:06:38 +01:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @see Command
|
|
|
|
*/
|
|
|
|
protected function configure()
|
|
|
|
{
|
|
|
|
$this
|
|
|
|
->setDescription('Generates SQL diff between the XML schemas and the current database structure')
|
|
|
|
->setHelp(<<<EOT
|
2011-02-02 02:31:12 +01:00
|
|
|
The <info>propel:migration:generate-diff</info> command compares the current database structure and the available schemas. If there is a difference, it creates a migration file.
|
2011-02-02 02:06:38 +01:00
|
|
|
|
2011-02-02 02:31:12 +01:00
|
|
|
<info>php app/console propel:migration:generate-diff</info>
|
2011-02-02 02:06:38 +01:00
|
|
|
EOT
|
|
|
|
)
|
2011-02-02 02:31:12 +01:00
|
|
|
->setName('propel:migration:generate-diff')
|
2011-02-02 02:06:38 +01:00
|
|
|
;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @see Command
|
|
|
|
*
|
|
|
|
* @throws \InvalidArgumentException When the target directory does not exist
|
|
|
|
*/
|
|
|
|
protected function execute(InputInterface $input, OutputInterface $output)
|
2011-04-18 21:40:16 +02:00
|
|
|
{
|
2011-02-02 02:06:38 +01:00
|
|
|
$this->callPhing('diff');
|
2011-04-13 22:27:07 +02:00
|
|
|
|
2011-08-30 11:52:30 +02:00
|
|
|
$this->writeSummary($output, 'propel-sql-diff');
|
2011-02-02 02:06:38 +01:00
|
|
|
}
|
|
|
|
}
|