mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-08-30 12:45:32 +08:00
feat(admin): XHProf 性能日志五张表 Scheme 迁移与模型
This commit is contained in:
27
database/migrations/20260814100003_xhprof_watch.php
Normal file
27
database/migrations/20260814100003_xhprof_watch.php
Normal 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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user