Files
ulthon_admin/database/migrations/20260725220000_add_timer_dynamic_control_fields.php
augushong 1d704fc32c fix(migration): 新增增量 migration 补齐 timer_config 与 system_host 缺失字段
建表 migration(SystemTimerConfig/SystemHost)建表时未含动态管控新增字段(trigger_node_id/last_trigger_time/concurrency/is_master),全新安装走 migrate:run 会缺字段。新增 ALTER migration 增量补齐,保证全新安装表结构完整。

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-07-25 22:22:47 +08:00

30 lines
1.3 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
use think\migration\Migrator;
/**
* 增量补字段:定时器动态管控 + 主节点标记
*
* 这些字段在 Scheme 和 adminUpdateCodeData/v2.3.0.php 分发代码中已存在,
* 但建表 migrationSystemTimerConfig / SystemHost建表时未含
* 全新安装走 migrate:run 会导致表结构缺字段。
* 本 migration 以 ALTER TABLE 增量补齐,保证全新安装完整。
*/
class AddTimerDynamicControlFields extends Migrator
{
public function change()
{
// system_timer_config 补动态管控3字段
$this->table('system_timer_config')
->addColumn('trigger_node_id', 'string', ['limit' => 100, 'null' => true, 'comment' => '手动触发目标节点ID'])
->addColumn('last_trigger_time', 'integer', ['limit' => 11, 'null' => true, 'comment' => '手动触发设置时间戳,用于TTL自动复位', 'signed' => false])
->addColumn('concurrency', 'integer', ['limit' => 4, 'null' => true, 'comment' => '并发数:NULL=继承代码默认'])
->update();
// system_host 补主节点标记
$this->table('system_host')
->addColumn('is_master', 'integer', ['limit' => 4, 'default' => 0, 'comment' => '是否主节点:0=否,1=是'])
->update();
}
}