Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comparator fails for BLOBS #2663

Closed
thomashohn opened this issue Feb 24, 2017 · 7 comments · Fixed by #4746
Closed

Comparator fails for BLOBS #2663

thomashohn opened this issue Feb 24, 2017 · 7 comments · Fixed by #4746

Comments

@thomashohn
Copy link

thomashohn commented Feb 24, 2017

In the TYPO3 project we use the diffColumn method in the class Doctrine\DBAL\Schema. Unfortunately this method fails to detect changes in BLOB columns. So changing a column from BLOB to another BLOB type fails - which is problematic in an MySql env.

@Ocramius
Copy link
Member

@thomashohn this needs a test case, as the issue as reported is too superficial.

@thomashohn
Copy link
Author

Create the following table:
create table test (
ablob blob
)

Try to change the column to ablob medium blob - the diffColumn doesn't catch this case.

@chrisguitarguy
Copy link
Contributor

Seems like this happens because the the MySqlPlatform uses length to determine blob size, but length is only diffed for a few types.

@Defcon0
Copy link

Defcon0 commented Feb 17, 2021

Is there any progress here? We‘re also experiencing this issue in our contao cms instance :-(

@ausi
Copy link
Contributor

ausi commented Mar 23, 2021

this needs a test case, as the issue as reported is too superficial.

I created pull request #4551 to fix this issue, it includes several test cases.

ausi added a commit to ausi/doctrine-dbal that referenced this issue May 29, 2021
ausi added a commit to ausi/doctrine-dbal that referenced this issue May 29, 2021
@morozov morozov linked a pull request Aug 23, 2021 that will close this issue
@morozov
Copy link
Member

morozov commented Aug 25, 2021

This bug will be indirectly covered by the Doctrine\DBAL\Tests\Functional\Schema\MySQL::testLobLengthIncrementOverLimit test in #4746.

Additionally,

$connection->executeStatement('DROP TABLE IF EXISTS test');
$connection->executeStatement('CREATE TABLE test (ablob BLOB)');

$sm = $connection->createSchemaManager();
$desiredTable = $sm->listTableDetails('test');

$connection->executeStatement('ALTER TABLE test MODIFY COLUMN ablob MEDIUMBLOB');

$actualTable = $sm->listTableDetails('test');

$comparator = $sm->createComparator();
$diff = $comparator->diffTable($desiredTable, $actualTable);
var_dump($diff);
/*
class Doctrine\DBAL\Schema\TableDiff#49 (14) {
    ...
}
*/

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants