Files
ulthon_admin/database/migrations/20260527100000_system_timer_config.php
augushong f2f2dcad98 feat(timer): 新增定时任务表的数据库迁移文件
补充 system_timer_config 和 system_timer_log 的数据库迁移,确保全新安装时 migrate:run 能正确建表

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

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-27 20:22:09 +08:00

45 lines
2.1 KiB
PHP

<?php
use think\migration\Migrator;
class SystemTimerConfig extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('system_timer_config')
->setComment('定时任务协调配置表')
->addColumn('task_name', 'string', ['limit' => 100, 'null' => false, 'comment' => '任务名称'])
->addColumn('run_type', 'string', ['limit' => 20, 'default' => 'auto', 'comment' => '运行类型:main/auto/all/manual'])
->addColumn('status', 'integer', ['limit' => 4, 'null' => false, 'default' => 1, 'comment' => '状态:0=停用,1=启用'])
->addColumn('is_synced', 'integer', ['limit' => 4, 'null' => false, 'default' => 0, 'comment' => '是否已同步:0=未同步,1=已同步'])
->addColumn('last_execute_node', 'string', ['limit' => 100, 'null' => true, 'comment' => '最后执行节点ID'])
->addColumn('last_execute_time', 'integer', ['limit' => 11, 'default' => 0, 'comment' => '最后执行时间戳', 'signed' => false])
->addColumn('manual_trigger', 'integer', ['limit' => 4, 'null' => false, 'default' => 0, 'comment' => '手动触发标记:0=未触发,1=已触发'])
->addColumn('create_time', 'integer', ['limit' => 11, 'comment' => '创建时间', 'signed' => false])
->addColumn('update_time', 'integer', ['limit' => 11, 'comment' => '更新时间', 'signed' => false])
->addIndex('task_name', ['unique' => true])
->create();
}
}