diff --git a/database/migrations/2026_09_15_105627_make_restart_limits_opt_in.php b/database/migrations/2026_09_15_105627_make_restart_limits_opt_in.php index 89d3efb333..9c1c927c01 100644 --- a/database/migrations/2026_09_15_105627_make_restart_limits_opt_in.php +++ b/database/migrations/2026_09_15_105627_make_restart_limits_opt_in.php @@ -2,10 +2,13 @@ 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 $withinTransaction = false; + /** * Run the migrations. */ @@ -15,6 +18,18 @@ return new class extends Migration Schema::table($tableName, function (Blueprint $table) { $table->integer('max_restart_count')->default(0)->change(); }); + + DB::table($tableName) + ->select('id') + ->where('max_restart_count', 10) + ->chunkById(5000, function ($resources) use ($tableName): void { + DB::table($tableName) + ->whereIn('id', $resources->pluck('id')) + ->update([ + 'max_restart_count' => 0, + 'restart_limit_reached' => false, + ]); + }); } } diff --git a/tests/Feature/AllResourceRestartLimitsTest.php b/tests/Feature/AllResourceRestartLimitsTest.php index 62594fc8b6..d1ff39d8ee 100644 --- a/tests/Feature/AllResourceRestartLimitsTest.php +++ b/tests/Feature/AllResourceRestartLimitsTest.php @@ -220,7 +220,12 @@ it('makes restart limits opt in for new application resources', function () { expect($migration) ->toContain("['applications', 'application_previews', 'service_applications']") ->toContain("integer('max_restart_count')->default(0)->change()") - ->not->toContain('->update('); + ->toContain('public $withinTransaction = false;') + ->toContain("->where('max_restart_count', 10)") + ->toContain('->chunkById(5000') + ->toContain("->whereIn('id', \$resources->pluck('id'))") + ->toContain("'max_restart_count' => 0") + ->toContain("'restart_limit_reached' => false"); $applicationSettings = file_get_contents(app_path('Livewire/Project/Application/Advanced.php')); $serviceSettings = file_get_contents(app_path('Livewire/Project/Service/Index.php'));