Files
ulthon_admin/database/migrations/20261012000003_notice_menu_config_align.php

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\InitDataAlignService;
use app\admin\service\MenuAlignService;
use think\console\Output;
use think\migration\Migrator;
/**
* 通知管理菜单与 notify 配置默认值对齐
*
* 背景:通知系统特性落地(system.notice 模块 + sysconfig notify 配置组),
* 快照变更配套迁移——adminInitData/SystemMenu.php 追加「通知管理」菜单
* (id=315,pid=228 系统管理组),adminInitData/SystemConfig.php 追加
* notify 组全部键的默认值行。按 ulthon-init-data-migration.md 铁律,
* 本迁移不硬编码任何数据副本,只调用对齐服务:
* - MenuAlignService::align('SystemMenu'):按快照显式 id 判存补插菜单行
* - InitDataAlignService::align():六域全量对齐(幂等安全),其中配置域
* 按 (group, name) 只插缺失并自动刷新 sysconfig 缓存
*
* 幂等:phinxlog 按文件记账保证只执行一次;重放由服务内的存在性检查兜底。
* down:数据对齐迁移不提供对称回滚(对齐只增不删,无法精确还原对齐前的
* 用户态数据),如需回退参考 adminInitData/ 快照手工处理。
*/
class NoticeMenuConfigAlign extends Migrator
{
public function up()
{
(new MenuAlignService(new Output()))->align('SystemMenu');
(new InitDataAlignService(new Output()))->align();
}
public function down()
{
// 有意留空:见类注释 down 说明
}
}