Skip to content

Commit 34c0cd7

Browse files
committed
Fix for Issue #1487 - Remove resolveTableName when applying schemaAssetsFilter
1 parent 6fd7684 commit 34c0cd7

File tree

2 files changed

+2
-17
lines changed

2 files changed

+2
-17
lines changed

src/Generator/DiffGenerator.php

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414

1515
use function method_exists;
1616
use function preg_match;
17-
use function strpos;
18-
use function substr;
1917

2018
/**
2119
* The DiffGenerator class is responsible for comparing two Doctrine\DBAL\Schema\Schema instances and generating a
@@ -127,7 +125,7 @@ private function createToSchema(): Schema
127125
foreach ($toSchema->getTables() as $table) {
128126
$tableName = $table->getName();
129127

130-
if ($schemaAssetsFilter($this->resolveTableName($tableName))) {
128+
if ($schemaAssetsFilter($tableName)) {
131129
continue;
132130
}
133131

@@ -137,17 +135,4 @@ private function createToSchema(): Schema
137135

138136
return $toSchema;
139137
}
140-
141-
/**
142-
* Resolve a table name from its fully qualified name. The `$name` argument
143-
* comes from Doctrine\DBAL\Schema\Table#getName which can sometimes return
144-
* a namespaced name with the form `{namespace}.{tableName}`. This extracts
145-
* the table name from that.
146-
*/
147-
private function resolveTableName(string $name): string
148-
{
149-
$pos = strpos($name, '.');
150-
151-
return $pos === false ? $name : substr($name, $pos + 1);
152-
}
153138
}

tests/Generator/DiffGeneratorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function testGenerate(): void
4747
$this->dbalConfiguration->expects(self::once())
4848
->method('getSchemaAssetsFilter')
4949
->willReturn(
50-
static fn ($name): bool => $name === 'table_name1',
50+
static fn ($name): bool => $name === 'schema.table_name1',
5151
);
5252

5353
$table1 = $this->createMock(Table::class);

0 commit comments

Comments
 (0)