feat(nginx-log): 新增 6 张表 phinx migration + Scheme + model

This commit is contained in:
augushong
2026-07-28 00:03:49 +08:00
parent f48e0947cb
commit 0d19881a22
18 changed files with 590 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
<?php
namespace app\admin\scheme;
use app\common\scheme\BaseScheme;
use app\common\scheme\attribute\Table;
use app\common\scheme\attribute\Field;
use app\common\scheme\attribute\Index;
#[Table(name: 'nginx_log_position', comment: 'nginx 日志文件读取位置(增量读取状态)')]
#[Index(columns: ['file_path'], name: 'uniq_file_path', type: 'UNIQUE')]
class NginxLogPosition extends BaseScheme
{
#[Field(type: 'int', length: 11, nullable: false, unsigned: true, autoIncrement: true, primary: true)]
public $id;
#[Field(type: 'varchar', length: 500, nullable: false, comment: '日志文件绝对路径')]
public $file_path;
#[Field(type: 'bigint', default: '0', unsigned: true, comment: '文件 inode用于检测日志轮转')]
public $inode;
#[Field(type: 'bigint', default: '0', unsigned: true, comment: '上次读取到的字节偏移')]
public $offset;
#[Field(type: 'int', length: 11, default: '0', unsigned: true, comment: '上次读取时间戳')]
public $last_read_time;
#[Field(type: 'varchar', length: 32, default: '', comment: '上次最后一行的 md5 哈希(容错校验)')]
public $last_line_hash;
#[Field(type: 'int', length: 11, default: '0', unsigned: true, comment: '解析失败累计次数')]
public $parse_fail_count;
#[Field(type: 'text', nullable: true, comment: '解析失败样本行(最多保留若干条)')]
public $parse_fail_samples;
#[Field(type: 'int', length: 11, unsigned: true, comment: '创建时间戳')]
public $create_time;
#[Field(type: 'int', length: 11, unsigned: true, comment: '更新时间戳')]
public $update_time;
}