Project

General

Profile

Actions

Bug #103348

closed

Database analyser doesn't detect sub type changes

Added by Christophe Monard 8 months ago. Updated 4 months ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
Database API (Doctrine DBAL)
Target version:
-
Start date:
2024-03-08
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
12
PHP Version:
8.2
Tags:
Install Tools, database analyser, database updater
Complexity:
Is Regression:
Yes
Sprint Focus:

Description

Hi there,

I'm having problems with the database analyzer:

When I try to change a field from text (tiny/text/medium) to another text "size" (eg. tinytext -> text | tinytext -> longtext), the updater just doesn't recognise the change.

I've tested this problem on a fresh and clean V12 instance to avoid interference from another extension, just by modifying a core ext_tables.sql files.

Christophe


Files

patchset.jpg (96.7 KB) patchset.jpg Database analyser showing difference for TEXT and BLOB "size" change Christophe Monard, 2024-03-14 09:49
Actions #1

Updated by Christophe Monard 8 months ago

  • Tags changed from Install Tools to Install Tools, database analyser, database updater
Actions #2

Updated by Rémy DANIEL 8 months ago

  • Description updated (diff)
Actions #3

Updated by Stefan Bürk 8 months ago

  • Category changed from Install Tool to Database API (Doctrine DBAL)
  • Assignee set to Stefan Bürk

Confirmation

Confirmed - only related to TYPO3 v12 / Doctrine DBAL 3.

Analysis

This is related to the Doctrine DBAL 3.x upgrade in TYPO3 v12,
which is a intermediate release from the Doctrine Team and marks
the Deprecation/Preparation "Major" version between v2 and v4.

The result is, that the Doctrine DBAL 3.x contains some quirks
and deprecation, with dual code branch execution and doublings.

Related to this issue are the extended classes required for the
TYPO3 Database Analyzer workflow.

\TYPO3\CMS\Core\Database\Schema\Comparator extends the DBAL
\Doctrine\DBAL\Schema\Comparator, and Doctrine DBAL changed
the inner parts of the comparator. The `diffColumn()` is marked
as deprecated and vanish with Doctrine DBAL 4, which will be
superseeded by the `columnsEqual()` dispatcher method, which
calls the `AbstractPlatform->columnsEqual()` method, if the
platform is set in the comparator.

Comparator instance creation without a platform is deprecated,
but has been allowed in the past. Due to the deprecation layer
for `compareSchemas()` and static -> non-static deprecation
move the platform is not passed down to the inner comparator
and checks pased on the platform are not executed.

That means, that the length check is not properly done due in
the overriden diffColumn() method, but passing the platform
through would dispatch the columsEqual() method which does the
comparison in other ways and leading to some noise, which can't
be properly handled in a bugfix safe way (and is still a open
issue for Doctrine DBAL 4 and TYPO3 v13).

However, this issue relates to an oversight and missing the
not available platform during the static to non-static compat
layer.

Possible fix(es)

Only possible way to fix this as a v12 bugfix I can see would
be:

  • pass the platform to the compareSchemas() call in the core
    ConnectionMigratior::buildSchemaDiff() method as 3rd param
    and use it for the new self() to pass the platform to the
    constructor
  • add a columnsEqual() method override to the extended
    Comparator class and adding a check against diffColumn()
    instead of using the AbstractPlatform::columnsEqual()
    method for now and adopt the current workaround from v13.

That means that hidden database changes could popup after
the fix, leading to datbase changes - albeit being considerable
not breaking.

With that, TINYTEXT <-> TEXT <-> MEDIAUMTEXT <-> LONGTEXT changes
are regonized again and can be applied.

Actions #4

Updated by Gerrit Code Review 8 months ago

  • Status changed from New to Under Review

Patch set 1 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/83457

Actions #5

Updated by Gerrit Code Review 8 months ago

Patch set 2 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/83457

Actions #6

Updated by Christophe Monard 8 months ago

Patchset is working for me on v12 instance.

Actions #7

Updated by Gerrit Code Review 8 months ago

Patch set 3 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/83457

Actions #8

Updated by Stefan Bürk 8 months ago

Christophe Monard wrote in #note-6:

Patchset is working for me on v12 instance.

Would be nice if you would vote on gerrit for the latest set then - at least the +1 verified for testing that it works for you.

Actions #9

Updated by Christophe Monard 8 months ago

Stefan Bürk wrote in #note-8:

Christophe Monard wrote in #note-6:

Patchset is working for me on v12 instance.

Would be nice if you would vote on gerrit for the latest set then - at least the +1 verified for testing that it works for you.

Sure, it's done :)

Actions #10

Updated by Stefan Bürk 8 months ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #11

Updated by Benni Mack 4 months ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF