简体   繁体   English

命令“queue:failed-table”未定义

[英]Command “queue:failed-table” is not defined

For some reason, I'm unable to generate a failed jobs table in Lumen 5.2.出于某种原因,我无法在 Lumen 5.2 中生成失败的作业表。

I've consulted:我咨询过:

The Lumen 5.2 Docs Lumen 5.2 文档

The Lumen 5.1 Docs Lumen 5.1 文档

The Laravel 5.2 Docs Laravel 5.2 文档

And the only one mentioned generator artisan queue:failed-table simply returns:而唯一提到的 generator 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 

Does anyone have a clue why this may be?有谁知道为什么会这样? The application itself is casting errors due to (well, errors) and not having a failed jobs table to process.由于(好吧,错误)并且没有要处理的失败作业表,应用程序本身正在抛出错误。

Much obliged!非常感谢!

I believe that CmdrSharp is correct that Lumen does not include the artisan queue:failed-table command.我相信 CmdrSharp 是正确的,Lumen 不包含artisan queue:failed-table命令。

In case it's helpful, here are the steps that I took to create a failed_jobs table myself:如果有帮助,以下是我自己创建 failed_jobs 表的步骤:

1) Create a migration for creating the failed_jobs table. 1) 创建迁移以创建 failed_jobs 表。 The generated migration will be placed in the /database/migrations folder.生成的迁移将放置在 /database/migrations 文件夹中。

php artisan make:migration create_failed_jobs_table --table=failed_jobs

2) Edit the migration so that it looks like this: 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) Run the migration to create the table 3) 运行迁移以创建表

php artisan migrate

Good luck!祝你好运!

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

php artisan queue:failed-table

It would appear that this was removed (unsure of which Lumen version).这似乎已被删除(不确定哪个 Lumen 版本)。 Creating one with the same structure as the Laravel failed_jobs table does the trick.创建一个与 Laravel failed_jobs 表结构相同的表就可以解决问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM