Upgrading
This page summarizes the breaking changes between major versions of laravel-schedule-monitor, based on the repository's UPGRADING.md and changelog, with the concrete steps for each upgrade. For every release's details, see the changelog on GitHub.
Version Overview
| Version | Laravel | PHP | Notable |
|---|---|---|---|
| 4.3.x | 11, 12, 13 | 8.2+ | Debug logging, configurable retry delay, OhDearPingFailed event; Laravel 9/10 and PHP 8.1 dropped in 4.3.0 |
| 4.2.0 | adds 13 | ||
| 4.1.0 | Configurable ping job (ping_oh_dear_job) |
||
| 4.0.0 | Built-in Oh Dear client, "sites" renamed to "monitors" | ||
| 3.x | CleanCommand replaced by model pruning |
||
| 2.x | 8 | Last line supporting Laravel 8 |
From v3 to v4
The Oh Dear integration was simplified, and Oh Dear renamed "sites" to "monitors".
- The Oh Dear SDK is no longer needed. The package now calls the Oh Dear API with Laravel's HTTP client. You can remove the separate SDK package from your
composer.jsonif nothing else in your application uses it. -
Replace
site_idwithmonitor_idin theoh_dearsection ofconfig/schedule-monitor.php:/* * The id of the monitor you want to sync the schedule with. * * You'll find this id on the settings page of a monitor at Oh Dear. */ 'monitor_id' => env('OH_DEAR_MONITOR_ID'), -
Rename the environment variable
OH_DEAR_SITE_IDtoOH_DEAR_MONITOR_IDin your.envfiles and deployment secrets. - Run
php artisan schedule-monitor:verify, thenphp artisan schedule-monitor:sync.
Warning: If you forget step 2 or 3,
monitor_idis empty: the sync then silently skips Oh Dear (only a yellow notice is printed), while tasks keep pinging the ping URLs stored by earlier syncs.
New in the 4.x line, all optional (add the keys to your published config to change them, see Configuration):
| Key | Since | Purpose |
|---|---|---|
oh_dear.api_url |
3.10.3 | Oh Dear API base URL |
oh_dear.endpoint_url |
3.10.0 | Custom ping endpoint |
oh_dear.ping_oh_dear_job |
4.1.0 | Custom ping job class |
oh_dear.retry_delay_ms |
4.3.0 | Delay between HTTP tries |
oh_dear.debug_logging |
4.3.0 | Diagnostics for failed pings |
From v2 to v3
The CleanCommand that deleted old log items was removed. Use Laravel's model pruning instead:
// routes/console.php (or the schedule() method of app/Console/Kernel.php)
use Illuminate\Support\Facades\Schedule;
use Spatie\ScheduleMonitor\Models\MonitoredScheduledTaskLogItem;
Schedule::command('model:prune', ['--model' => MonitoredScheduledTaskLogItem::class])->daily();
Remove the old clean command from your schedule. The retention period is still delete_log_items_older_than_days. See Prune Old Log Items.
From v1 to v2
Add a nullable string column timezone to the monitored_scheduled_tasks table, and fill it in existing rows with your application's timezone:
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('monitored_scheduled_tasks', function (Blueprint $table) {
$table->string('timezone')->nullable();
});
DB::table('monitored_scheduled_tasks')->update(['timezone' => config('app.timezone')]);
}
};
Running schedule-monitor:sync afterwards also sets the timezone of every task still in the schedule.
After Any Upgrade
- Compare your published
config/schedule-monitor.phpwith the package's current file and add new keys you want to use. - Run
php artisan schedule-monitor:syncso the database and Oh Dear reflect the current code. - Run
php artisan schedule-monitor:listand check for unnamed or duplicate tasks.