mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-09-05 07:15:31 +08:00
feat(nginx-log): 新增 6 张表 phinx migration + Scheme + model
This commit is contained in:
26
database/migrations/20260726100004_nginx_stat_url.php
Normal file
26
database/migrations/20260726100004_nginx_stat_url.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
|
||||
/**
|
||||
* nginx 日志分析 - 按 URL 聚合统计表
|
||||
*
|
||||
* 每个统计日 + URI 一行,记录 PV/UV/流量/平均耗时,用于热门 URL 排行。
|
||||
*/
|
||||
class NginxStatUrl extends Migrator
|
||||
{
|
||||
public function change()
|
||||
{
|
||||
$table = $this->table('nginx_stat_url')
|
||||
->setComment('nginx 按 URL 聚合统计')
|
||||
->addColumn('stat_date', 'integer', ['limit' => 11, 'null' => false, 'comment' => '统计日期(YYYYMMDD)', 'signed' => false])
|
||||
->addColumn('uri', 'string', ['limit' => 255, 'null' => false, 'comment' => '请求 URI'])
|
||||
->addColumn('pv', 'integer', ['limit' => 11, 'default' => 0, 'comment' => '页面浏览量'])
|
||||
->addColumn('uv', 'integer', ['limit' => 11, 'default' => 0, 'comment' => '独立访客数'])
|
||||
->addColumn('total_bytes', 'biginteger', ['default' => 0, 'comment' => '总流量(字节)'])
|
||||
->addColumn('avg_request_time', 'decimal', ['precision' => 10, 'scale' => 3, 'default' => 0, 'comment' => '平均请求耗时(秒)'])
|
||||
->addIndex(['stat_date', 'uri'], ['unique' => true, 'name' => 'uniq_date_uri'])
|
||||
->addIndex(['stat_date'], ['name' => 'idx_stat_date'])
|
||||
->create();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user