| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
- declare(strict_types=1);
- use Phinx\Migration\AbstractMigration;
- class CreateCronJobLog extends AbstractMigration
- {
- public function change(): void
- {
- $table = $this->table('cron_job_log', [
- 'comment' => '定时任务执行日志',
- 'engine' => 'InnoDB',
- 'collation' => 'utf8mb4_general_ci',
- 'id' => false,
- 'primary_key' => ['id'],
- ]);
- $table->addColumn('id', 'biginteger', [
- 'identity' => true,
- 'signed' => false,
- 'comment' => '主键'
- ])->addColumn('name', 'string', [
- 'limit' => 100,
- 'null' => false,
- 'comment' => '任务名称'
- ])->addColumn('rule', 'string', [
- 'limit' => 50,
- 'null' => false,
- 'comment' => 'cron规则'
- ])->addColumn('duration', 'decimal', [
- 'precision' => 10,
- 'scale' => 4,
- 'default' => 0,
- 'comment' => '执行耗时(秒)'
- ])->addColumn('success', 'boolean', [
- 'default' => true,
- 'comment' => '是否成功'
- ])->addTimestamps('create_time', false)
- ->addIndex(['name', 'id'], [
- 'name' => 'idx_name_id'
- ])->create();
- }
- }
|