6

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

sumit
  • 15,003
  • 12
  • 69
  • 110

1 Answers1

31

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 :)

Lionel Chan
  • 7,894
  • 5
  • 40
  • 69
  • 1
    I have no idea what the difference is but no matter what I try the 'table' property from the config does not stop it from going the 'jobs' table. – niczak Jan 09 '19 at 21:10
  • Which config file you are changing? You probably have a queue.php under config and edited the default queue.php from the framework. You should edit the one in app/config itself. – Lionel Chan Jan 10 '19 at 06:57