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

Migrations which upgrade mediumint columns to int do not have any effect #10453

Closed
bdach opened this issue Aug 10, 2023 · 1 comment
Closed
Labels
priority:0 Showstopper. Critical to the next release.

Comments

@bdach
Copy link
Contributor

bdach commented Aug 10, 2023

Originally reported on discord.

It appears that since #10247 (I've confirmed experimentally that it's since the laravel 10 upgrade specifically), migrations that upgrade/widen mediumint columns to int have stopped functioning correctly. One such instance is this:

$table->mediumInteger('play_count')->unsigned()->default(0);

to this:

$table->integer('play_count')->unsigned()->nullable(false)->default(0)->change();

After running all migrations, the table should have type int unsigned, while in fact it appears to have type mediumint unsigned.

The direct implications of this are that:

  • test databases will not be consistent schema-wise with production
  • in local setups, databases may fail to seed as the seeding data will not be insertable to tables due to columns being too narrow

Here is a gist with 2 excerpts of mysql statements executed during captured using general_log while the aforementioned migration was running.

  • On 2023.706.0 (last commit before merge of aforementioned PR) the column width changes are successfully generated
  • On current master the column width changes are skipped entirely.

There are several threads of possibility where this might have broken (changes in dbal, laravel itself...) but given I know very little about the php ecosystem I'm not willing to hazard guesses or link any links.

It may be wise to run a full cross-check of test/local db schemas against production to make sure no other cases of such silent breakage have occurred somewhere else.

@peppy peppy added the priority:0 Showstopper. Critical to the next release. label Aug 12, 2023
@nanaya
Copy link
Collaborator

nanaya commented Aug 22, 2023

Fixed in #10454

@nanaya nanaya closed this as completed Aug 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority:0 Showstopper. Critical to the next release.
Projects
None yet
Development

No branches or pull requests

3 participants