Laravel 11: Be Careful with Changing Columns in Migrations

preview_player
Показать описание
A new Laravel 11 behavior that is the opposite of previous versions.

- - - - -
Support the channel by checking out my products:

- - - - -
Other places to follow:
Рекомендации по теме
Комментарии
Автор

The reason for this change is because laravel 11 rewrites the migration process to remove doctrine/dbal as dependency.

This dependency is there solely for changing table columns in sqlite, but it was used for any RDBMS you used. The worst part is that, doctrine/dbal has been used as custom type mappings for your specific RDBMS, but never fully utilized in laravel even though it was supported.

As such, now you must redeclare all attributes for changing your column. I see this change as a small compromise over having doctrine/dbal for just changing columns.

The benefit is that, now the column change migration is self-documented, and actually much clearer of what the expected result should be.

gtdmg
Автор

OMG imp info.. i frequently change columns

shubhamsahuSD
Автор

Column definitions are stored in MySQL, so the migration can read it and only change what the dev asked to change. Something like $column->nullable(false) could do? I love and recommend Laravel, please have a proper fix for this, this new behavior feels like a downgrade : not intuitive and breaks backward compatibility.

pominglam
Автор

this only when you want to change right?

ArshAudioBooks
Автор

A change that breaks backwards compatibility that I don't understand... for the MySQL driver it wasn't necessary... as for any relational DSBMS... I can always modify only the "nullable" attribute of a column...
Changing the default in this way forces those who have not yet done squash to revise the migrations backwards!!!!

MarcoAcorte
Автор

It's a nonsense breaking change 😮

MarcoAcorte