Skip to content

Commit

Permalink
Merge branch '3.4.x' into 4.0.x
Browse files Browse the repository at this point in the history
* 3.4.x:
  Bump Symfony components to supported version ranges
  Fix link in deprecation message
  Table schema clone is not needed in SqlitePlatform
  • Loading branch information
derrabus committed Jul 15, 2022
2 parents 211c892 + c60fd26 commit 577123d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
4 changes: 2 additions & 2 deletions composer.json
Expand Up @@ -47,8 +47,8 @@
"phpunit/phpunit": "9.5.21",
"psalm/plugin-phpunit": "0.17.0",
"squizlabs/php_codesniffer": "3.7.1",
"symfony/cache": "^5.2|^6.0",
"symfony/console": "^2.7|^3.0|^4.0|^5.0|^6.0",
"symfony/cache": "^5.4|^6.0",
"symfony/console": "^4.4|^5.4|^6.0",
"vimeo/psalm": "4.24.0"
},
"suggest": {
Expand Down
12 changes: 5 additions & 7 deletions src/Platforms/SqlitePlatform.php
Expand Up @@ -631,14 +631,12 @@ public function getAlterTableSQL(TableDiff $diff): array
);
}

$table = clone $fromTable;

$columns = [];
$oldColumnNames = [];
$newColumnNames = [];
$columnSql = [];

foreach ($table->getColumns() as $column) {
foreach ($fromTable->getColumns() as $column) {
$columnName = strtolower($column->getName());
$columns[$columnName] = $column;
$oldColumnNames[$columnName] = $newColumnNames[$columnName] = $column->getQuotedName($this);
Expand Down Expand Up @@ -703,15 +701,15 @@ public function getAlterTableSQL(TableDiff $diff): array
$tableSql = [];

if (! $this->onSchemaAlterTable($diff, $tableSql)) {
$dataTable = new Table('__temp__' . $table->getName());
$dataTable = new Table('__temp__' . $fromTable->getName());

$newTable = new Table(
$table->getQuotedName($this),
$fromTable->getQuotedName($this),
$columns,
$this->getPrimaryIndexInAlteredTable($diff, $fromTable),
[],
$this->getForeignKeysInAlteredTable($diff, $fromTable),
$table->getOptions()
$fromTable->getOptions()
);

$newTable->addOption('alter', true);
Expand All @@ -722,7 +720,7 @@ public function getAlterTableSQL(TableDiff $diff): array
'CREATE TEMPORARY TABLE %s AS SELECT %s FROM %s',
$dataTable->getQuotedName($this),
implode(', ', $oldColumnNames),
$table->getQuotedName($this)
$fromTable->getQuotedName($this)
);
$sql[] = $this->getDropTableSQL($fromTable->getQuotedName($this));

Expand Down

0 comments on commit 577123d

Please sign in to comment.