Skip to content

Commit

Permalink
Add upgrade note about schema_filter change
Browse files Browse the repository at this point in the history
  • Loading branch information
alcaeus authored and nicolas-grekas committed Dec 16, 2019
1 parent 17bb051 commit 0b5aaaf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
6 changes: 6 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ Method `Doctrine\ORM\AbstractQuery#useResultCache()` which could be used for bot
To optimize DB interaction, `Doctrine\ORM\Tools\Pagination\Paginator` no longer fetches identifiers to be able to
perform the pagination with join collections when max results isn't set in the query.

## Minor BC BREAK: tables filtered with `schema_filter` are no longer created

When generating schema diffs, if a source table is filtered out by a `schema_filter` expression, then a `CREATE TABLE` was
always generated, even if the table already existed. This has been changed in this release and the table will no longer
be created.

## Deprecated number unaware `Doctrine\ORM\Mapping\UnderscoreNamingStrategy`

In the last patch of the `v2.6.x` series, we fixed a bug that was not converting names properly when they had numbers
Expand Down
13 changes: 4 additions & 9 deletions lib/Doctrine/ORM/Tools/SchemaTool.php
Original file line number Diff line number Diff line change
Expand Up @@ -918,10 +918,9 @@ public function getUpdateSchemaSql(array $classes, $saveMode = false)
private function createSchemaForComparison(Schema $toSchema) : Schema
{
// backup schema assets filter and filter-expression
$sm = $this->em->getConnection()->getSchemaManager();
$config = $this->em->getConnection()->getConfiguration();
$filterExpression = method_exists(Configuration::class, 'getFilterSchemaAssetsExpression') ? $config->getFilterSchemaAssetsExpression() : null;
$filter = $config->getSchemaAssetsFilter();
$sm = $this->em->getConnection()->getSchemaManager();
$config = $this->em->getConnection()->getConfiguration();
$filter = $config->getSchemaAssetsFilter();

if ($filter === null) {
return $sm->createSchema();
Expand All @@ -938,11 +937,7 @@ private function createSchemaForComparison(Schema $toSchema) : Schema
return $sm->createSchema();
} finally {
// restore schema assets filter and filter-expression
if ($filterExpression !== null) {
$config->setFilterSchemaAssetsExpression($filterExpression);
} else {
$config->setSchemaAssetsFilter($filter);
}
$config->setSchemaAssetsFilter($filter);
}
}
}

0 comments on commit 0b5aaaf

Please sign in to comment.