-
Notifications
You must be signed in to change notification settings - Fork 11.3k
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
Column altering in migration may not apply #12363
Comments
Doctrine can make a difference between the various text sizes. See mapping matrix. For example.
If your issue is valid, there must be something wrong with calculateDoctrineTextLength. Maybe you can try and validate that. |
I investigated deeper and found a problem in vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php _getPortableTableColumnDefinition method. For example I create a migration with single mutation So i debug $tableColumn var at beginning of the method :
Then I debug result :
) As you can see original longtext became a portable text type. So table diff will not be detected. I think such a behaviour may be useful when same code should work with different databases, but it is bug when we make a migration. |
You should file your findings over at https://github.com/doctrine/dbal/issues/new 😃 This isn't an issue with Laravel. Laravel uses |
I have a text column called "body" . Then I want to alter it to be longText, so I run a migration with
$table->longText('body')->change();
(of course I have doctrine/dbal in my composer.json)So migration runs ok, but actually no modification occurs.
I make some investigation and found that Laravel uses Doctrine\DBAL\Schema\Comparator class to make diffTable. Ok, sounds good, but how it compares columns? I debugged column properties at diffColumn method and see that my "longText" become to Doctrine\DBAL\Types\TextType.
So Doctrine makes no difference between Text and LongText. It is not ok.
The text was updated successfully, but these errors were encountered: