datarose/illuminate-blueprint-recall
Composer 安装命令:
composer require datarose/illuminate-blueprint-recall
包简介
Blueprint macro for Laravel to restore column attribute persistence in migrations. Update only what you need. (Unofficial)
README 文档
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
datarose/illuminate-blueprint-recall 适用场景与选型建议
datarose/illuminate-blueprint-recall 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 04 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「migration」 「blueprint」 「laravel」 「change」 「preserve」 「recall」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 datarose/illuminate-blueprint-recall 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 datarose/illuminate-blueprint-recall 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 datarose/illuminate-blueprint-recall 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Testing object factory for PHP
Testing object factory for PHP
Api documentation generator for Laravel 5
Lets you add foreign keys in a swift! Foreign key adder in laravel migration.
Laravel database schema extended, added some PostgreSql features
Manage PostgreSQL schemas in Laravel applications
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 48
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: AGPL-3.0-only
- 更新时间: 2026-04-24