Why is Laravel 6.x creating a failed_jobs migration by default

Klearn :

I am creating a messages table in Laravel migrations but it's creating another table too called create_failed_jobs_table. I didn't create this, its a new project. It's happening in every project that I create it automatically creates this table too while creating also the other table, I don't know if its something I've done that creates it. Here is this file:

create_failed_jobs_table):

<?php

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

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

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

create_messages_table:)

<?php

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

class CreateMessagesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('messages', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->timestamps();
        });
    }

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

Lex de Willigen :

To answer your question so that your question can be marked as answered: the failed_jobs table comes default with all Laravel 6.x projects. You can check the release note for other things that changed in release 6.0.

Notice that Laravel 6.0 also added a new driver option to the config. That's probably why they've also included the migration by default.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=11915&siteId=1