Merge conflict Gerrit cannot merge this change. It needs a rebase onto main.

Review main Work in progress Orphaned

93670[WIP][TASK] Remove `GetColumnDeclarationSQLCommentTypeAwareTrait`

Stefan Bürk CR +1 V +1 Hard +62 −215 updated 04/16/26, 14:11

Commit message

The `GetColumnDeclarationSQLCommentTypeAwareTrait` was introduced
during the upgrade to Doctrine DBAL 4. It reimplemented the
comment-based type handling that had been removed, automatically
adding type hints to column comments where required.

At the time, this logic had to live in platform overrides due to
the legacy column comparison from Doctrine DBAL 3, which has since
been removed.

[1] However, placing this logic in the platform layer makes it
impossible to properly address an `SQLite` limitation. `SQLite`
does not support inline comments for simplified

 ALTER TABLE ADD COLUMN <definition>

statements, which causes issues when adding columns that require
type hint comments.

[2] A potential fix for the SQLite ADD COLUMN issue would be to
return false in SQLitePlatform::getSimpleAlterTableSQL() and fall
back to the full ALTER TABLE logic. This should ideally be fixed
upstream in Doctrine DBAL. However, this approach requires that
type hints are already present in the column configuration.

Type hints are added too late in `getColumnDeclarationSQL()`,
which is called from within `getSimpleAlterTableSQL()` and makes
it difficult to propagate the required information properly.

To prepare for this fix, type hints are now added earlier in the
ConnectionMigrator. They are applied to relevant column types in
the virtual schema.

As a result, the `GetColumnDeclarationSQLCommentTypeAwareTrait`
has been removed being now obsolete along with its usage in all
extended platform classes.

Platform classes that no longer provide functionality after this
removal have also been deleted. The SQLitePlatform remains in
place to allow temporary overrides until an upstream fix is
available.

This change also supports the broader goal of reducing custom
Doctrine DBAL extensions and the maintenance overhead associated
with them.

[1] dbal issue description
[2] dbal pull-request

Test this change

Run a command in your clone of the TYPO3 Core. Then try what the change does and vote on Verified in Gerrit. How to review a patch

Check out patch set 3
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/70/93670/3 && git checkout FETCH_HEAD
Cherry-pick onto main
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/70/93670/3 && git cherry-pick FETCH_HEAD

Review

  • Code review CR +1 Needs a vote
    • Markus Klein +1
  • Verified V +1 Needs a vote
    • Markus Klein +1
    • core-ci +1 CI

Relation chain 2

  1. main 93673[WIP][TASK] add doctrine/dbal required bugfix Based on this change Work in progress Merge conflict Stefan Bürk CR +1 V +1 → 13.4 database-analyzer Normal +162 −3
  2. 93670 [WIP][TASK] Remove `GetColumnDeclarationSQLCommentTypeAwareTrait` This change

Files 15

Review log 811

  1. Stefan Bürk uploaded patch set 1 04/14/26, 17:40

  2. Stefan Bürk wrote 04/14/26, 17:40

    Topic set to database-analyzer
  3. Stefan Bürk updated the commit message in patch set 2 04/14/26, 17:44

  4. Stefan Bürk updated the commit message in patch set 3 04/14/26, 17:45

  5. core-ci voted on patch set 2 V +1 04/14/26, 18:00 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/100186

  6. core-ci voted on patch set 1 V +1 04/14/26, 18:19 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/100184

  7. core-ci voted on patch set 3 V +1 04/14/26, 18:29 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/100187

  8. Markus Klein commented on patch set 3 04/14/26, 21:40

    ConnectionMigrator.php:1645

    I think we can inline this short function in the even shorter function above

    ConnectionMigrator.php:2183

    named args? not allowed right? is this a valid pattern? shouldn't the regex have some wrapper like '#'?

    ConnectionMigrator.php:2187

    I'd prefer `$replaced === null`, if doable
  9. Stefan Bürk commented on patch set 3 04/16/26, 12:53

    ConnectionMigrator.php:1645 Reply

    I guess that is okay. Left over, in first iteration I needed that check also in other places and the reason why it existed. Having only the usage in the method above that should be fine to inline. Checking it again when working on the change again.

    ConnectionMigrator.php:2183 Reply

    > named args? not allowed right? preg_replace() is one of the explicitly mentioned excemptions from the not use named arguments, see: https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/PhpArchitecture/NamedArguments.html#leveraging-named-arguments-when-invoking-php-functions > Another instance arises with complex functions like preg_replace(), where developers often overlook argument positions and names: > is this a valid pattern? shouldn't the regex have some wrapper like '#'? Sure. And it literally works. TBH that pattern is copied over from doctrine which used that for years before dropping the "comment type hints" with Doctrine DBAL 4 and I never wanted to mangele around with it. Fine for you ?

    ConnectionMigrator.php:2187 Reply

    `preg_replace(): array|string|null` The native return type allows also an array, which should not happen and was the reson to use the `is_string()` check a) for phpstan (possible, not checked) and b) to avoid type errors in case a array is returned and tried to pass to `trim()` which enforces native type string as argument and the reason why I would keep that for now. Fine for you ?
  10. Markus Klein commented on patch set 3 04/16/26, 13:58

    ConnectionMigrator.php:1645 Reply

    Done

    ConnectionMigrator.php:2183 Reply

    Funny. sure keep as is.

    ConnectionMigrator.php:2187 Reply

    I'm aware of the possible array type, but this cannot happen; that's why I was asking. But no hard feelings. keep.
  11. Markus Klein voted on patch set 3 CR +1 V +1 04/16/26, 14:11