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
Migrating a varchar to a bigint causes invalid charset instructions to appear #30539
Comments
What was the error message? |
Those character set and collate instructions should not have been there. |
What version of the |
Here: |
Can you try downgrading to It looks like this is the same bug: doctrine/dbal#3714 |
It does indeed look like the same bug, I'll subscribe to that bug tracker to see when it's been fixed and I could update this ticket in turn. I don't have the time at the moment to try the downgrade due to work pressures and the manual script work around is functional for the moment, but if I get a chance to I shall look in to it. |
Seems like this is related to DBAL and not Laravel so going to close this one. |
DBAL just closed the issue: see doctrine/dbal#3714 (comment) |
Can please folks from Laravel and folks from Doctrine make an agreement and push this issue a bit further? Laravel says it's issue on Doctrine's side. Doctrine says it's issue on Laravel side. Meanwhile we are locked on older version of Doctrine when we want to keep our projects up-to-date. Please note this happened to us when changing varchar column to integer. |
Hello everyone, I'm one of the core members of the Doctrine team 👋 As I mentioned on the issue in DBAL, I completely understand your frustration and am sorry for this inconvenience. We really believe that the issue is related to how Laravel configures the DBAL objects to perform the comparisons and think that it was working previously due to a bug that got fixed. I don't know Laravel so much to solve this but feel free to ping me in a PR or on Doctrine's slack channel and I'll do my best to support the resolution of this issue. @JohnyProkie thanks for pointing us here and @driesvints and other Laravel maintainers for their hard work on building bridges between the two projects 🤟 |
@lcobucci Thank you a lot for stepping in! |
Let's figure this out. If anyone could help pinpoint where we can implement a fix that'd be great. @lcobucci thanks for your hard work on Doctrine as well :) |
@driesvints I haven't debugged anything but framework/src/Illuminate/Database/Schema/Grammars/ChangeColumn.php Lines 125 to 127 in 1bbe552
Laravel should make sure to not set the charset/collation info on the objects while performing the changes. |
@lcobucci it does seem that only applies to framework/src/Illuminate/Database/Schema/Grammars/ChangeColumn.php Lines 124 to 128 in 1bbe552
|
@driesvints that's the problem. As @AlterTable explained it:
Laravel should define Does this help? |
@lcobucci heya, it does. I think this is indeed the correct way to go forward. I currently don't have time to work on this so if anyone is experiencing this issue and wants to move this forward, feel free to send in a PR. |
Hi all, if anyone on Laravel 6.x & doctrine/dbal 2.10 experiencing this issue, the quick fix is to set charset and collation to empty string on column change statement. For example:
It does work on my case where previous column type is string (varchar). |
This unfortunately isn't working for me for some reason. I've tried $table->bigInteger('number')
->charset('')
->collation('')
->change(); I finally ended up just running the raw query: \DB::statement('alter table orders modify number bigint not null'); |
Fixed by fccdf7c |
still present in: error while trying to change column from text to blob workaround for me was to make a intermediary migration that runs above the alter and drop the column and recreate it for both fwd and reverse migration
|
@strtz try to update dependencies |
It worked thanks @taylorotwell |
to work around laravel/framework#30539
Description:
While writing a migration to fix a bad database that had stored a foreign key as a varchar, I wrote the following migration:
However, this above migration generated the following SQL:
Work Around: Removing the instructions related to the character set and running this query manually was successful.
Steps To Reproduce:
The text was updated successfully, but these errors were encountered: