承接 datarose/illuminate-blueprint-recall 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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:

  1. Reads the current table name from the active Blueprint.
  2. Loads the table columns from the database schema.
  3. Finds the requested column.
  4. Converts the database column type back to a Laravel Blueprint type.
  5. Re-applies existing attributes such as:
    • nullable
    • default value
    • unsigned
    • auto increment
    • comment
  6. 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 我们能提供哪些服务?
定制开发 / 二次开发

基于 datarose/illuminate-blueprint-recall 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 48
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: AGPL-3.0-only
  • 更新时间: 2026-04-24