Project

General

Profile

Actions

Bug #67413

closed

Database Analyzer complains about sets with values having uppercase letters

Added by Stephan Großberndt over 9 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Install Tool
Target version:
-
Start date:
2015-06-11
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
7
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

Definition in ext_tables.sql:

subtype set('Tx_MyExt_Domain_Model_Xyz','Tx_MyExt_Domain_Model_Abc','') NOT NULL DEFAULT '',

In TYPO3 4.7 this worked without problems (MySQL has no problems with upper- or mixed case in set), in TYPO3 6.2 the database compare complains and wants to change the case of all set entries to lowercase:

subtype set('tx_myext_domain_model_xyz','tx_myext_domain_model_abc','') NOT NULL DEFAULT '',

Luckily I spotted this before applying all database changes, otherwise the subtypes had been '' in all records now..

The problem is in typo3\sysext\install\Classes\Service\SqlSchemaMigrationService.php : SqlSchemaMigrationService->getDatabaseExtra()

// Lowercase the field type to surround false-positive schema changes to be
// reported just because of different caseing of characters
// The regex does just trigger for the first word followed by round brackets
// that contain a length. It does not trigger for e.g. "PRIMARY KEY" because
// "PRIMARY KEY" is being returned from the DB in upper case.
$fieldC = preg_replace_callback(
    '/^([a-zA-Z0-9]+\(.*\))(\s)(.*)/',
    create_function(
        '$matches',
        'return strtolower($matches[1]) . $matches[2] . $matches[3];'
    ),
    $fieldC
);

This should lead to lowercasing for fieldtypes with a length e.g. int (11) but matches for set or enum too currently.

By changing the regexp to match only fields with a number in brackets this is solved:

// Lowercase the field type to surround false-positive schema changes to be
// reported just because of different caseing of characters
// The regex does just trigger for the first word followed by round brackets
// that contain a length. It does not trigger for e.g. "PRIMARY KEY" because
// "PRIMARY KEY" is being returned from the DB in upper case.
$fieldC = preg_replace_callback(
    '/^([a-zA-Z0-9]+\(\d*\))(\s)(.*)/',
    create_function(
        '$matches',
        'return strtolower($matches[1]) . $matches[2] . $matches[3];'
    ),
    $fieldC
);
Actions

Also available in: Atom PDF