5

For some reason, I'm unable to generate a failed jobs table in Lumen 5.2.

I've consulted:

The Lumen 5.2 Docs

The Lumen 5.1 Docs

The Laravel 5.2 Docs

And the only one mentioned generator artisan queue:failed-table simply returns:

[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!

Rob
  • 14,746
  • 28
  • 47
  • 65
CmdrSharp
  • 1,085
  • 13
  • 30
  • did you type `php artisan queue:failed-table`, emphasis on the **php**? I just tried on my laravel project and the command worked just fine. – Alex Harris Jul 08 '16 at 04:29
  • @chasenyc Yep - otherwise Symfony wouldn't be the thing returning errors ;) It works fine on my Laravel install too, it's the Lumen one that it doesn't work on. – CmdrSharp Jul 08 '16 at 04:40
  • @CmdrSharp This command might not be in lumen. Try `php artisan list`. If you don't see it you can copy paste the command form laravel installation is suppose. – z3r0ck Jul 08 '16 at 06:42

3 Answers3

6

I believe that CmdrSharp is correct that Lumen does not include the artisan queue:failed-table command.

In case it's helpful, here are the steps that I took to create a failed_jobs table myself:

1) Create a migration for creating the failed_jobs table. The generated migration will be placed in the /database/migrations folder.

php artisan make:migration create_failed_jobs_table --table=failed_jobs

2) Edit the migration so that it looks like this:

<?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

php artisan migrate

Good luck!

clone45
  • 8,952
  • 6
  • 35
  • 43
3

For laravel , To create a migration for the failed_jobs table, you may use the queue:failed-table command:

php artisan queue:failed-table

eaglebearer
  • 2,060
  • 1
  • 13
  • 9
0

It would appear that this was removed (unsure of which Lumen version). Creating one with the same structure as the Laravel failed_jobs table does the trick.

CmdrSharp
  • 1,085
  • 13
  • 30