Your nullable columns might not be nullable anymore in Laravel 11

You might have already noticed it in the Laravel 11 upgrade guide, but one change in Laravel 11 is worth thinking about when upgrading.

When changing columns you now have to re-apply all modifiers. For example, imagine you have an original migration that adds a description column:

$table->string('description')->nullable();

When after a while you create a new migration to modify the column, you will get different results in Laravel 11 than in previous Laravel versions:

$table->string('description', 100)->change();

// Laravel 10: is_nullable=true
// Laravel 11: is_nullable=false

The correct way to make sure your column stays nullable is to also call the ->nullable() method in the migration where you update the column:

$table->string('description', 100)->nullable()->change();

The same applies for any other modifiers you applied (for example default, comment, unsigned).

It's a good idea to check and update your older migrations to avoid unexpected problems in your test suite or local environment when refreshing the database.