用途:在 Laravel 13 中设计数据库结构、编写与管理迁移,覆盖 Schema Builder 建表改表删表、50 多种列类型及修饰符、主键/唯一/全文/空间索引、带级联选项的外键约束,以及用 Seeder 填充数据。
主要能力:提供迁移类型决策(新表、加列、改列、加索引、种子数据)、列类型选择(id、foreignId()->constrained()、uuid()->primary()、boolean、enum、json、decimal、timestamps、softDeletes)、外键级联策略(restrictOnDelete、cascadeOnDelete、nullOnDelete、noActionOnDelete),并附模板与参考文档(schema、columns、indexes、foreign-keys、commands、seeding、testing、production、troubleshooting)。
使用方式:按强制工作流,实现前并行发起三个 Agent 调用:fuse-ai-pilot:explore-codebase 检查现有迁移、fuse-ai-pilot:research-expert 经 Context7 核对 Laravel 13 模式、mcp__context7__query-docs 查询具体 Schema Builder 特性;实现后运行 fuse-ai-pilot:sniper 校验。常用命令:php artisan make:migration create_posts_table、php artisan migrate、php artisan migrate:rollback --step=1、php artisan migrate:fresh --seed。
关键规则:始终定义 down() 保证可回滚;用 foreignId()->constrained() 而非裸 unsignedBigInteger;为外键加索引;部署前测试回滚;不修改已部署迁移,只新建。可用 --pretend 预览 SQL。
Laravel 13 特性:Schema::ensureVectorExtensionExists() 在 PostgreSQL 启用 pgvector,配合 vector('embedding', dimensions: 1536)->index() 建 HNSW 余弦向量索引,向量列/索引也支持 MariaDB 11.7+;13.9+ 的 foreignUuidFor()、13.25+ 的 foreignUlidFor();PostgreSQL/SQL Server 的无锁索引 ->online();13.33+ MySQL 的 ->inplace()。
限制:资料未提供收费、价格、平台支持范围与效果数据,暂未提供。