Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename parameters of the diff-related methods #5768

Merged
merged 1 commit into from
Oct 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Platforms/MySQL/Comparator.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ public function __construct(
parent::__construct($platform);
}

public function diffTable(Table $fromTable, Table $toTable): ?TableDiff
public function diffTable(Table $oldTable, Table $newTable): ?TableDiff
{
return parent::diffTable(
$this->normalizeTable($fromTable),
$this->normalizeTable($toTable),
$this->normalizeTable($oldTable),
$this->normalizeTable($newTable),
);
}

Expand Down
12 changes: 6 additions & 6 deletions src/Platforms/SQLServer/Comparator.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ public function __construct(SQLServerPlatform $platform, private readonly string
parent::__construct($platform);
}

public function diffTable(Table $fromTable, Table $toTable): ?TableDiff
public function diffTable(Table $oldTable, Table $newTable): ?TableDiff
{
$fromTable = clone $fromTable;
$toTable = clone $toTable;
$oldTable = clone $oldTable;
$newTable = clone $newTable;

$this->normalizeColumns($fromTable);
$this->normalizeColumns($toTable);
$this->normalizeColumns($oldTable);
$this->normalizeColumns($newTable);

return parent::diffTable($fromTable, $toTable);
return parent::diffTable($oldTable, $newTable);
}

private function normalizeColumns(Table $table): void
Expand Down
12 changes: 6 additions & 6 deletions src/Platforms/SQLite/Comparator.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ public function __construct(SQLitePlatform $platform)
parent::__construct($platform);
}

public function diffTable(Table $fromTable, Table $toTable): ?TableDiff
public function diffTable(Table $oldTable, Table $newTable): ?TableDiff
{
$fromTable = clone $fromTable;
$toTable = clone $toTable;
$oldTable = clone $oldTable;
$newTable = clone $newTable;

$this->normalizeColumns($fromTable);
$this->normalizeColumns($toTable);
$this->normalizeColumns($oldTable);
$this->normalizeColumns($newTable);

return parent::diffTable($fromTable, $toTable);
return parent::diffTable($oldTable, $newTable);
}

private function normalizeColumns(Table $table): void
Expand Down
20 changes: 10 additions & 10 deletions src/Platforms/SQLitePlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -785,11 +785,11 @@ private function getSimpleAlterTableSQL(TableDiff $diff): array|false
}

/** @return string[] */
private function getColumnNamesInAlteredTable(TableDiff $diff, Table $fromTable): array
private function getColumnNamesInAlteredTable(TableDiff $diff, Table $oldTable): array
{
$columns = [];

foreach ($fromTable->getColumns() as $column) {
foreach ($oldTable->getColumns() as $column) {
$columnName = $column->getName();
$columns[strtolower($columnName)] = $columnName;
}
Expand Down Expand Up @@ -825,10 +825,10 @@ private function getColumnNamesInAlteredTable(TableDiff $diff, Table $fromTable)
}

/** @return Index[] */
private function getIndexesInAlteredTable(TableDiff $diff, Table $fromTable): array
private function getIndexesInAlteredTable(TableDiff $diff, Table $oldTable): array
{
$indexes = $fromTable->getIndexes();
$columnNames = $this->getColumnNamesInAlteredTable($diff, $fromTable);
$indexes = $oldTable->getIndexes();
$columnNames = $this->getColumnNamesInAlteredTable($diff, $oldTable);

foreach ($indexes as $key => $index) {
foreach ($diff->getRenamedIndexes() as $oldIndexName => $renamedIndex) {
Expand Down Expand Up @@ -899,10 +899,10 @@ private function getIndexesInAlteredTable(TableDiff $diff, Table $fromTable): ar
}

/** @return ForeignKeyConstraint[] */
private function getForeignKeysInAlteredTable(TableDiff $diff, Table $fromTable): array
private function getForeignKeysInAlteredTable(TableDiff $diff, Table $oldTable): array
{
$foreignKeys = $fromTable->getForeignKeys();
$columnNames = $this->getColumnNamesInAlteredTable($diff, $fromTable);
$foreignKeys = $oldTable->getForeignKeys();
$columnNames = $this->getColumnNamesInAlteredTable($diff, $oldTable);

foreach ($foreignKeys as $key => $constraint) {
$changed = false;
Expand Down Expand Up @@ -959,11 +959,11 @@ private function getForeignKeysInAlteredTable(TableDiff $diff, Table $fromTable)
}

/** @return Index[] */
private function getPrimaryIndexInAlteredTable(TableDiff $diff, Table $fromTable): array
private function getPrimaryIndexInAlteredTable(TableDiff $diff, Table $oldTable): array
{
$primaryIndex = [];

foreach ($this->getIndexesInAlteredTable($diff, $fromTable) as $index) {
foreach ($this->getIndexesInAlteredTable($diff, $oldTable) as $index) {
if (! $index->isPrimary()) {
continue;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Schema/AbstractSchemaManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -606,10 +606,10 @@ public function alterSchema(SchemaDiff $schemaDiff): void
*
* @throws Exception
*/
public function migrateSchema(Schema $toSchema): void
public function migrateSchema(Schema $newSchema): void
{
$schemaDiff = $this->createComparator()
->compareSchemas($this->introspectSchema(), $toSchema);
->compareSchemas($this->introspectSchema(), $newSchema);

$this->alterSchema($schemaDiff);
}
Expand Down
Loading