feat(admin): XHProf 性能日志五张表 Scheme 迁移与模型

This commit is contained in:
augushong
2026-08-14 22:04:52 +08:00
parent da388a8c4f
commit 7e73902325
15 changed files with 478 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
<?php
use think\migration\Migrator;
/**
* XHProf 性能日志 - 函数监控规则表
*
* regex 为 PCRE 正则导入任务按被调用callee函数名匹配命中边聚合到 run_watch 表。
*/
class XhprofWatch extends Migrator
{
public function change()
{
$table = $this->table('xhprof_watch', ['id' => false, 'primary_key' => ['id']])
->setComment('XHProf 函数监控规则')
->addColumn('id', 'integer', ['limit' => 11, 'null' => false, 'signed' => false, 'identity' => true, 'comment' => '主键ID'])
->addColumn('name', 'string', ['limit' => 100, 'null' => false, 'comment' => '规则名称(人读)'])
->addColumn('regex', 'string', ['limit' => 255, 'null' => false, 'comment' => 'PCRE 正则(对被调用函数名匹配)'])
->addColumn('note', 'string', ['limit' => 255, 'null' => false, 'default' => '', 'comment' => '备注'])
->addColumn('threshold_ms', 'integer', ['limit' => 11, 'default' => 0, 'comment' => '比对阈值毫秒0=不比对'])
->addColumn('status', 'tinyinteger', ['limit' => 4, 'default' => 1, 'comment' => '状态:1=启用,0=禁用'])
->addColumn('create_time', 'integer', ['limit' => 11, 'comment' => '创建时间戳', 'signed' => false])
->addColumn('update_time', 'integer', ['limit' => 11, 'comment' => '更新时间戳', 'signed' => false])
->addIndex(['regex'], ['unique' => true, 'name' => 'uniq_regex'])
->create();
}
}