Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
166 views
in Technique[技术] by (71.8m points)

php - How to change Laravel's Job Batching table name and connection

Laravel 8 introduced Job Batching, which allows to execute jobs in batches and perform actions on batch completion. However Laravel documentation does not have a section regarding configurations of Job Batching table and database connection.

How can different database for job_batching table can be specified, and is it possible to rename the job_batching table name?

question from:https://stackoverflow.com/questions/65901419/how-to-change-laravels-job-batching-table-name-and-connection

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Open queue.php file in the config/ folder.

You can specify custom database and table name by editing/adding the batching key:

return [
    /* Default Queue Connection Name */
    'default' => env('QUEUE_CONNECTION', 'sync'),
    ...

    // ADD THIS SECTION
    'batching' => [
        'database' => '<custom_database>',
        'table' => '<custom_job_batching>',
    ],

    ...
];

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...