Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

customising Job and job table in Laravel queue/ rename jobs table

When I try php artisan queue:table It gave me the following error

  [InvalidArgumentException]                   
  A CreateJobsTable migration already exists.  

It is because I have already the migration named CreateJobsTable for other purpose. I cannot rename this table and migration . Is there any way to rename the migration to CreateJobsQueueTable or some thing relevant?

can we rename the jobs table that artisan creates with 'queue:table'?

like image 765
sumit Avatar asked Dec 23 '16 02:12

sumit


1 Answers

Yes. Edit this file config\queue.php:

<?php

return [

    ....

    'connections' => [

        ....

        'database' => [
            'driver' => 'database',
            'table' => 'jobs',      <------ Edit this to something else
            'queue' => 'default',
            'retry_after' => 90,
        ],

        ....
    ],

    ....
];

Change the table name to other value, and it should pick up by the TableCommand. Check out Illuminate\Queue\Console\TableCommand on how it uses this value. It's pretty much straightforward :)

like image 127
Lionel Chan Avatar answered Sep 30 '22 18:09

Lionel Chan