I am using Laravel Framework version Lumen (5.2.5). My requirement is to change jobs table name ( instead of jobs, I want uat_jobs in UAT and prod_jobs in PROD).
So as suggested in other StackOverflow anwer , changed table name in config\\queue.php file but unable to create new job table. Getting error while runing php artisan queue:table command.
Thanks for the help in advance.
Lumen doesn't have the queue:table
command - that's for Laravel. You'll want to create the jobs table migration(s) manually. From the docs:
Schema::create('jobs', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('queue');
$table->longText('payload');
$table->tinyInteger('attempts')->unsigned();
$table->tinyInteger('reserved')->unsigned();
$table->unsignedInteger('reserved_at')->nullable();
$table->unsignedInteger('available_at');
$table->unsignedInteger('created_at');
$table->index(['queue', 'reserved', 'reserved_at']);
});
Remember to rename the table in the above code to what you want.
Docs for your version: https://lumen.laravel.com/docs/5.2/queues - if you are not used to queues in Lumen, you'll want to read the rest in there as well.
For dynamically change job table name use
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
public function register()
{
if ('PROD' == $this->app->environment()) {
Config::set('queue.connections.database.table', 'prod_jobs');
} else if ('UAT' == $this->app->environment()) {
Config::set('queue.connections.database.table', 'uat_jobs');
}
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.