Laravel "queue:prune-batches" is not defined

Viewed 412

Following the Laravel docs, it says here that the batches table should be pruned daily by running the following.

$schedule->command('queue:prune-batches')->daily();

I've tried running this command on my server and I get the error:

Command "queue:prune-batches" is not defined.

I searched Google but I couldn't find any matching results for this error or many results for "queue:prune-batches" for that matter.

Am I missing something?

Screen-shot of Command "queue:prune-batches" is not defined.

2 Answers

That command was added in Laravel 8.21.

You can determine your exact version installed by doing one of the following:

  1. Check composer.lock it should have the exact installed version in there
  2. Run composer show laravel/framework the exact installed version should be in the first few lines of the output
  3. Check vendor/laravel/framework/src/Illuminate/Foundation/Application.php for the VERSION constant
  4. Run dd(VERSION) in any route to get the constant from (3) dumped

Since Laravel is using semver there's generally no harm running composer update to update to the latest minor version and get all documented features.

Figuring this out is a rather complex process of searching the github repository for that command and finding this commit that added it. It lists all the tags that the commit was merged with and those start from v8.21.0

Have you executed first the following?

php artisan queue:batches-table

php artisan migrate
Related