Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

php

laravel

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');
    }
}

like image 603
Coder Avatar asked Jan 26 '26 00:01

Coder


1 Answers

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.

like image 137
Lex de Willigen Avatar answered Jan 27 '26 12:01

Lex de Willigen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!