datarose / illuminate-blueprint-recall
Blueprint macro for Laravel to restore column attribute persistence in migrations. Update only what you need. (Unofficial)
Package info
github.com/datarose-dev/illuminate-blueprint-recall
pkg:composer/datarose/illuminate-blueprint-recall
Requires
- php: ^8.2|^8.3|^8.4|^8.5
- illuminate/contracts: ^11.0|^12.0|^13.0
Requires (Dev)
- orchestra/pest-plugin-testbench: ^4.0
- orchestra/testbench: ^11.0
- pestphp/pest: ^4.0
- rector/rector: ^2.4
This package is auto-updated.
Last update: 2026-04-25 20:26:59 UTC
README
datarose/illuminate-blueprint-recall is an unofficial Laravel package that restores column attribute persistence when changing existing columns in migrations.
It adds a column() macro to Laravel's Blueprint, allowing you to update only the attributes you actually want to change.
Schema::table('users', function (Blueprint $table) { $table->column('votes')->nullable(); });
Instead of repeating the full column definition:
Schema::table('users', function (Blueprint $table) { $table->integer('votes') ->unsigned() ->default(1) ->comment('The vote count') ->nullable() ->change(); });
Why this exists
Starting with Laravel 11, modifying a column requires redefining all existing attributes of that column. If an attribute is not explicitly included in the migration, Laravel may drop it.
For example, given this original column:
Schema::create('users', function (Blueprint $table) { $table->integer('votes') ->unsigned() ->default(1) ->comment('The vote count'); });
This Laravel 11+ migration only makes the column nullable, but may drop the previous unsigned, default, and comment attributes:
Schema::table('users', function (Blueprint $table) { $table->integer('votes')->nullable()->change(); });
Laravel now expects the full definition:
Schema::table('users', function (Blueprint $table) { $table->integer('votes') ->unsigned() ->default(1) ->comment('The vote count') ->nullable() ->change(); });
datarose/illuminate-blueprint-recall avoids this repetition by reading the current column definition from the database and applying the existing attributes automatically.
Get started
Install the package with Composer:
composer require datarose/illuminate-blueprint-recall
Laravel package auto-discovery will register the service provider automatically.
If you do not use auto-discovery, register the provider manually:
Datarose\BlueprintRecall\BlueprintRecallServiceProvider::class
Usage
Use column() when you want to change an existing column while keeping its current attributes.
Make a column nullable
use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; Schema::table('users', function (Blueprint $table) { $table->column('votes')->nullable(); });
The package recalls the existing column type and attributes, then applies only the new change.
Remove nullable
Schema::table('users', function (Blueprint $table) { $table->column('votes')->nullable(false); });
Change multiple attributes
Schema::table('users', function (Blueprint $table) { $table->column('votes') ->nullable() ->default(0); });
Keep the original type
You do not need to specify whether the column is an integer, string, text, decimal, or another supported type.
Schema::table('users', function (Blueprint $table) { $table->column('email')->nullable(); });
The package resolves the existing database column and builds the matching Laravel column definition before calling change().
How it works
The package registers a column() macro on Laravel's Illuminate\Database\Schema\Blueprint.
When called, it:
- Reads the current table name from the active
Blueprint. - Loads the table columns from the database schema.
- Finds the requested column.
- Converts the database column type back to a Laravel Blueprint type.
- Re-applies existing attributes such as:
- nullable
- default value
- unsigned
- auto increment
- comment
- Returns the column definition with
change()already applied.
This lets your migration focus on the change you actually want to make.
$table->column('votes')->nullable();
IDE support
The package includes an optional IDE helper file for macro autocomplete.
It documents the added column() method on Blueprint and boolean-capable column modifiers such as:
$definition->autoIncrement(false); $definition->unsigned(false);
If your IDE does not pick it up automatically, make sure Composer dev autoload files are loaded:
composer dump-autoload
Limitations
This package is intentionally focused on Laravel migration ergonomics and depends on the database schema information available through Laravel.
Some column types, database drivers, generated columns, indexes, or platform-specific attributes may require additional handling.
The package is unofficial and not maintained by the Laravel framework team.
Testing
composer install
composer test
or directly:
./vendor/bin/pest
Contributing
Contributions are welcome.
To work on the package locally:
git clone https://github.com/datarose-net/illuminate-blueprint-recall.git cd illuminate-blueprint-recall composer install composer test
License & Acknowledgments
This project is open source and released under the GNU Affero General Public License v3.0 (AGPL-3.0).
This package was created to make Laravel 11+ column migrations easier to maintain when changing existing columns.
Laravel is a trademark of Taylor Otwell. This package is unofficial and is not affiliated with or endorsed by Laravel or Taylor Otwell.
Copyright (C) 2020—present Zoltán Rózsa & Datarose