Skip to content

Commit

Permalink
Merge pull request #1463 from morozov/issues/1415
Browse files Browse the repository at this point in the history
Compensate difference between DBAL schema introspection and ORM generation
  • Loading branch information
greg0ire authored Oct 10, 2024
2 parents 03b040e + 2bc98c4 commit 5007eb1
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/Generator/DiffGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Doctrine\Migrations\Generator\Exception\NoChangesDetected;
use Doctrine\Migrations\Provider\SchemaProvider;

use function method_exists;
use function preg_match;
use function strpos;
use function substr;
Expand Down Expand Up @@ -63,6 +64,18 @@ static function ($assetName) use ($filterExpression) {

$toSchema = $this->createToSchema();

// prior to DBAL 4.0, the schema name was set to the first element in the search path,
// which is not necessarily the default schema name
if (
! method_exists($this->schemaManager, 'getSchemaSearchPaths')
&& $this->platform->supportsSchemas()
) {
$defaultNamespace = $toSchema->getName();
if ($defaultNamespace !== '') {
$toSchema->createNamespace($defaultNamespace);
}
}

$comparator = $this->schemaManager->createComparator();

$upSql = $this->platform->getAlterSchemaSQL($comparator->compareSchemas($fromSchema, $toSchema));
Expand Down

0 comments on commit 5007eb1

Please sign in to comment.