Skip to content

Commit

Permalink
Upgrade DBAL to v3.6.x (#1073)
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek authored Aug 15, 2023
1 parent f6c1143 commit b09d3b5
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@
"require": {
"php": ">=7.4 <8.3",
"atk4/core": "dev-develop",
"doctrine/dbal": "~3.4.5",
"doctrine/dbal": "~3.4.5 || ~3.5.1 || ~3.6.0",
"mvorisek/atk4-hintable": "~1.9.0"
},
"require-release": {
"php": ">=7.4 <8.3",
"atk4/core": "~5.0.0",
"doctrine/dbal": "~3.4.5",
"doctrine/dbal": "~3.4.5 || ~3.5.1 || ~3.6.0",
"mvorisek/atk4-hintable": "~1.9.0"
},
"require-dev": {
Expand Down
10 changes: 10 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ parameters:
path: '*'
count: 3

# TODO for DBAL 4.0 upgrade
-
message: '~^Instantiation of deprecated class Doctrine\\DBAL\\Event\\Listeners\\OracleSessionInit:\nUse \{@see \\Doctrine\\DBAL\\Driver\\OCI8\\Middleware\\InitializeSession\} instead\.$~'
path: 'src/Persistence/Sql/Oracle/Connection.php'
count: 1
-
message: '~^(Fetching deprecated class constant postConnect of class Doctrine\\DBAL\\Events\.|Fetching class constant postConnect of deprecated class Doctrine\\DBAL\\Events\.|Parameter \$args of method postConnect\(\) in anonymous class has typehint with deprecated class Doctrine\\DBAL\\Event\\ConnectionEventArgs\.)$~'
path: 'src/Persistence/Sql/Sqlite/Connection.php'
count: 3

# TODO these rules are generated, this ignores should be fixed in the code
# for src/Schema/TestCase.php
- '~^Call to an undefined method Atk4\\Data\\Persistence::dsql\(\)\.$~'
Expand Down
15 changes: 15 additions & 0 deletions src/Persistence/Sql/Sqlite/SchemaManagerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,21 @@ public function alterTable(TableDiff $tableDiff): void
}
}

// fix collations unescape for SqliteSchemaManager::parseColumnCollationFromSQL() method
// https://github.com/doctrine/dbal/issues/6129

protected function _getPortableTableColumnList($table, $database, $tableColumns)
{
$res = parent::_getPortableTableColumnList($table, $database, $tableColumns);
foreach ($res as $column) {
if ($column->hasPlatformOption('collation')) {
$column->setPlatformOption('collation', $this->unquoteTableIdentifier($column->getPlatformOption('collation')));
}
}

return $res;
}

// fix quoted table name support for private SqliteSchemaManager::getCreateTableSQL() method
// https://github.com/doctrine/dbal/blob/3.3.7/src/Schema/SqliteSchemaManager.php#L539
// TODO submit a PR with fixed SqliteSchemaManager to DBAL
Expand Down

0 comments on commit b09d3b5

Please sign in to comment.