Files
ulthon_admin/database/migrations/20260909120000_system_menu_align.php
augushong e54c772868 feat(admin): 菜单快照对齐迁移,存量库自动补齐运行管理与XHProf菜单
对齐迁移是菜单快照进入数据库的唯一途径(新装与存量库同路径);缺失行按显式 id 补插,框架结构行仅对齐 pid+sort,软删/用户分组跳过;新增规则文件与索引;清理 status 模块孤儿占位文件。

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-09-09 14:37:56 +00:00

38 lines
1.5 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
use app\admin\service\MenuAlignService;
use think\console\Output;
use think\migration\Migrator;
/**
* 系统菜单快照对齐 - 存量库补齐与「运行管理」结构重组
*
* 背景:本迁移是菜单快照数据进入数据库的唯一途径——新装与存量库均通过 migrate:run
* 执行。快照在 2026-08-15(8cbe62a)重组出「运行管理」分组(309/310/311)并补录
* XHProf 四条菜单(304~307),彼时该批变更仅对新装生效、存量库无升级脚本覆盖,
* 本迁移补上这一缺口。
*
* 本迁移调用 MenuAlignService 把当前快照整体对齐到库:
* - 缺失行按显式 id 补插(含 304~307/309~311 与后续快照新增的 314 日志读取位置)
* - 挂在框架结构上的存量行仅对齐 pid + sort(运行管理重组的 pid 迁移)
* - 用户自定义(软删除 / 自建分组 / id 占用)一律跳过,详见服务类注释
*
* 幂等:phinxlog 按文件记账保证只执行一次;重放由服务内的存在性检查兜底。
* down:数据对齐迁移不提供对称回滚(无法精确还原对齐前的用户态结构),
* 如需回退参考 adminInitData/SystemMenu.php 快照手工处理。
*/
class SystemMenuAlign extends Migrator
{
public function up()
{
$service = new MenuAlignService(new Output());
$service->align('SystemMenu');
}
public function down()
{
// 有意留空:见类注释 down 说明
}
}