Bug #14139

Install tool is incapable of comparing modern database dumps

Added by Ingmar Schlecht over 11 years ago. Updated almost 9 years ago.

Status:Closed Start date:2004-05-03
Priority:Could have Due date:
Assigned To:Ingmar Schlecht % Done:

0%

Category:Install Tool Spent time: -
Target version:-
TYPO3 Version:3.8.0beta2 Is Regression:
PHP Version: Sprint Focus:
Complexity:

Description

When I use the "Database Analyzer" of the Typo3 install tool to compare the current database to the file typo3conf/database.sql it shows me lots of differences although the current database is in fact exactly the same as the database.sql file so there should NOT be ANY difference.

When I look closer at it, I see that the only differences Typo3 finds is the order of things.

It says it needs to do this...
ALTER TABLE be_groups CHANGE tstamp tstamp
int(11) unsigned NOT NULL default '0';

...because the current value is this:
int(11) unsigned DEFAULT '0' NOT NULL

This bug is present in the install tool as well as in the extension manager.

I might be able to provide a fix for this when I've got some spare time, so I'll assign this bug to me.
(issue imported from #M55)


Related issues

related to Core - Bug #14354: MySQL gt 4.1 no default value for auto inc Closed 2004-10-12
duplicated by Core - Bug #14336: Database analyzer gives stupid Alter statements by compar... Closed 2004-09-22

History

#1 Updated by Ingmar Schlecht about 11 years ago

quick and DIRTY (!) fix for t3lib_install:

Replace the line:
} elseif (strcmp($FDcomp[$table][$theKey][$fieldN], $fieldC)){
with:
} elseif (strcmp($this->getNormalizedFieldDefinition($fieldC), $this->getNormalizedFieldDefinition($FDcomp[$table][$theKey][$fieldN]))){

And somewhere below insert this new function:

function getNormalizedFieldDefinition($FD) {
// remove duplicate spaces and convert to upper case
$FD = ereg_replace(' +',' ',strtoupper($FD));
$mysqlExpressions = array(
'NOT NULL' => 'not_null',
"DEFAULT \'([^']*)\'" => 'default_\\1', // DOES THIS DOES NOT WORK STABLE!
);
foreach($mysqlExpressions as $mysqlExpression => $replacement) {
$FD = ereg_replace($mysqlExpression,$replacement,$FD);
}
if(strstr($FD,'AUTO_INCREMENT')) {
$FD = str_replace('default_0','',$FD);
}
$parts = t3lib_div::trimExplode(' ',$FD);
sort($parts);
if(!strcmp($parts[0],'')) unset ($parts[0]);
return implode($parts,',');
}

#2 Updated by old_facorreia about 11 years ago

I have a similar situation, but it is not only the order of things:

ALTER TABLE be_groups CHANGE uid uid int(11) unsigned NOT NULL auto_increment;
Current value: int(11) unsigned DEFAULT '0' NOT NULL auto_increment

The difference is that the Current value has DEFAULT '0' and the definition doesn't.

#3 Updated by Michael Stucki over 10 years ago

Should be fixed in 3.8.0beta2 - please reopen if this is wrong.

#4 Updated by Peter Niederlag over 10 years ago

I still find these problems wit 3.8.0beta2 as well as current HEAD.

Install-Tool->Update required tables->COMPARE

ALTER TABLE be_groups CHANGE uid uid int(11) DEFAULT '0' NOT NULL auto_increment;
Current value: int(11) unsigned DEFAULT '0' NOT NULL auto_increment
.....
.....

#5 Updated by Peter Niederlag about 10 years ago

seems finally solved.
Thx to all bugfixers

Also available in: Atom PDF