mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-10-29 08:58:22 +08:00
refactor(install): 种子退役,migrate:run 一条命令完成建表与初始数据
新增 InitDataAlignService 六域对齐(超管/角色/权限节点/配置/快捷入口/商城演示)与 20260909130000 迁移;SystemAdmin 快照以字面量哈希入库;删除种子三件与安装锁依赖,seeds 目录留 .gitkeep;README/tests/规则等 11 处说明同步。 Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
36
database/migrations/20260909130000_system_init_data.php
Normal file
36
database/migrations/20260909130000_system_init_data.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use app\admin\service\InitDataAlignService;
|
||||
use think\console\Output;
|
||||
use think\migration\Migrator;
|
||||
|
||||
/**
|
||||
* 系统初始化数据对齐 - 种子退役后初始数据的唯一安装途径
|
||||
*
|
||||
* 背景:seed:run 退役,migrate:run 成为唯一安装命令(建表 + 全部初始数据)。
|
||||
* 本迁移调用 InitDataAlignService 把 adminInitData/ 快照对齐到当前库:
|
||||
* - 超管 id=1 只插不改(密码永不覆盖,软删行不复活)
|
||||
* - 角色 id=1/id=6 逐行只插
|
||||
* - 权限节点跳过(注解动态扫描)
|
||||
* - 配置按 (group, name) 只插缺失,插后清 sysconfig 缓存
|
||||
* - 快捷入口按 href 只插缺失(软删行不复活)
|
||||
* - 商城演示分表守卫(cate/goods/tag 各自空则插)
|
||||
*
|
||||
* 幂等:phinxlog 按文件记账保证只执行一次;重放由服务内的存在性检查兜底。
|
||||
* down:数据对齐迁移不提供对称回滚(无法精确还原对齐前的用户态数据),
|
||||
* 如需回退参考 adminInitData/ 下各快照手工处理。
|
||||
*/
|
||||
class SystemInitData extends Migrator
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$service = new InitDataAlignService(new Output());
|
||||
|
||||
$service->align();
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
// 有意留空:见类注释 down 说明
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user