5

出于某种原因,我无法在 Lumen 5.2 中生成失败的作业表。

我咨询过:

Lumen 5.2 文档

Lumen 5.1 文档

Laravel 5.2 文档

唯一提到的生成器artisan queue:failed-table只是返回:

[Symfony\Component\Console\Exception\CommandNotFoundException]  
Command "queue:failed-table" is not defined.                    
Did you mean one of these?                                      
    queue:failed                                                
    queue:forget                                                
    queue:flush                                                 
    queue:retry                                                 
    queue:work                                                  
    queue:listen                                                
    queue:restart 

有谁知道为什么会这样?由于(嗯,错误)并且没有要处理的失败作业表,应用程序本身正在投射错误。

非常感谢!

4

3 回答 3

6

我相信 CmdrSharp 是正确的 Lumen 不包含该artisan queue:failed-table命令。

如果有帮助,以下是我自己创建 failed_jobs 表的步骤:

1) 为创建 failed_jobs 表创建迁移。生成的迁移将放置在 /database/migrations 文件夹中。

php artisan make:migration create_failed_jobs_table --table=failed_jobs

2) 编辑迁移,使其看起来像这样:

<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateFailedJobsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('failed_jobs', function (Blueprint $table) {
            $table->increments('id');
            $table->text('connection');
            $table->text('queue');
            $table->longText('payload');
            $table->timestamp('failed_at')->useCurrent();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('failed_jobs');
    }
}

3)运行迁移以创建表

php artisan migrate

祝你好运!

于 2016-10-21T17:07:48.427 回答
1

对于 laravel ,要为 failed_jobs 表创建迁移,您可以使用 queue:failed-table 命令:

php artisan queue:failed-table

于 2020-07-04T13:20:10.720 回答
0

看来这已被删除(不确定哪个 Lumen 版本)。创建一个与 Laravel failed_jobs 表具有相同结构的表就可以了。

于 2016-07-09T08:41:10.757 回答