在Laravel队列/重命名作业表中自定义作业和作业表 [英] customising Job and job table in Laravel queue/ rename jobs table

查看:498
本文介绍了在Laravel队列/重命名作业表中自定义作业和作业表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试php artisan queue:table 它给了我以下错误

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

  [InvalidArgumentException]                   
  A CreateJobsTable migration already exists.  

这是因为我已经将迁移命名为CreateJobsTable用于其他目的.我无法重命名该表并进行迁移.有什么办法可以将迁移重命名为CreateJobsQueueTable或其他相关内容?

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?

我们可以用'queue:table'重命名工匠创建的Jobs表吗?

推荐答案

是.编辑此文件config\queue.php:

<?php

return [

    ....

    'connections' => [

        ....

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

        ....
    ],

    ....
];

table名称更改为其他值,它应该由TableCommand接听.查看Illuminate\Queue\Console\TableCommand如何使用此值.这非常简单:)

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

这篇关于在Laravel队列/重命名作业表中自定义作业和作业表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆