Skip to content

Commit

Permalink
Fix unwanted SQLite schema emulation in SqliteSchemaManager
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Feb 24, 2024
1 parent 1452a09 commit 4aadd00
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Platforms/SqlitePlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,7 @@ public function getTemporaryTableName($tableName)
*/
public function canEmulateSchemas()
{
Deprecation::trigger(
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/4805',
'SqlitePlatform::canEmulateSchemas() is deprecated.',
Expand Down
12 changes: 9 additions & 3 deletions src/Schema/SqliteSchemaManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,9 @@ protected function selectTableColumns(string $databaseName, ?string $tableName =

if ($tableName !== null) {
$conditions[] = 't.name = ?';
$params[] = str_replace('.', '__', $tableName);
$params[] = $this->_platform->canEmulateSchemas()
? str_replace('.', '__', $tableName)
: $tableName;
}

$sql .= ' WHERE ' . implode(' AND ', $conditions) . ' ORDER BY t.name, c.cid';
Expand All @@ -729,7 +731,9 @@ protected function selectIndexColumns(string $databaseName, ?string $tableName =

if ($tableName !== null) {
$conditions[] = 't.name = ?';
$params[] = str_replace('.', '__', $tableName);
$params[] = $this->_platform->canEmulateSchemas()
? str_replace('.', '__', $tableName)
: $tableName;
}

$sql .= ' WHERE ' . implode(' AND ', $conditions) . ' ORDER BY t.name, i.seq';
Expand All @@ -755,7 +759,9 @@ protected function selectForeignKeyColumns(string $databaseName, ?string $tableN

if ($tableName !== null) {
$conditions[] = 't.name = ?';
$params[] = str_replace('.', '__', $tableName);
$params[] = $this->_platform->canEmulateSchemas()
? str_replace('.', '__', $tableName)
: $tableName;
}

$sql .= ' WHERE ' . implode(' AND ', $conditions) . ' ORDER BY t.name, p.id DESC, p.seq';
Expand Down

0 comments on commit 4aadd00

Please sign in to comment.