table('queue_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' => 200, 'null' => false, 'comment' => '任务类名' ])->addColumn('connection', 'string', [ 'limit' => 50, 'null' => false, 'comment' => '队列连接' ])->addColumn('queue', 'string', [ 'limit' => 255, 'null' => false, 'comment' => '队列名称' ])->addColumn('attempts', 'integer', [ 'default' => 1, 'signed' => false, 'comment' => '当前第几次尝试' ])->addColumn('duration', 'decimal', [ 'precision' => 10, 'scale' => 4, 'default' => 0, 'comment' => '执行耗时(秒)' ])->addColumn('success', 'boolean', [ 'default' => true, 'comment' => '是否成功' ])->addColumn('exception', 'text', [ 'null' => true, 'comment' => '异常信息' ])->addTimestamps('create_time', false) ->addIndex(['name', 'id'], [ 'name' => 'idx_name_id' ])->addIndex(['create_time'], [ 'name' => 'idx_create_time' ])->create(); } }