Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Don't create a diff if there are no mapping information changes #106

wants to merge 1 commit into from

5 participants


Although there is code to not generate a diff if there are no mapping information changes, there is always a statement (the abort statement if the database platform doesn't match) so a migration file is always created. This patch addresses that.

Mentioned in #41 and #104




Does anyone have any feedback on this?


Would be VERY useful. Tired to do a migration and migrate it to see it contain nothing :(


Fixed by #160.

@stof stof closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
12 lib/Doctrine/DBAL/Migrations/Tools/Console/Command/DiffCommand.php
@@ -115,15 +115,21 @@ public function execute(InputInterface $input, OutputInterface $output)
private function buildCodeFromSql(Configuration $configuration, array $sql)
$currentPlatform = $configuration->getConnection()->getDatabasePlatform()->getName();
- $code = array(
- "\$this->abortIf(\$this->connection->getDatabasePlatform()->getName() != \"$currentPlatform\");", "",
- );
+ $abortCode = "\$this->abortIf(\$this->connection->getDatabasePlatform()->getName() != \"$currentPlatform\");";
+ $code = array();
foreach ($sql as $query) {
if (strpos($query, $configuration->getMigrationsTableName()) !== false) {
$code[] = "\$this->addSql(\"$query\");";
+ if (empty($code)) {
+ return;
+ }
+ array_unshift($code, $abortCode, "");
return implode("\n", $code);
Something went wrong with that request. Please try again.