fix(proxy): run legacy Traefik label migration outside a transaction

In Postgres one failed server update aborts a shared transaction, so
all later queries fail and the upgrade stops. Save each server on its
own so that one failure affects only that server.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Andras Bacsai
2026-09-25 23:25:39 +02:00
co-authored by Claude Opus 5.5
parent f92ee342a1
commit b2b8177982
2 changed files with 12 additions and 0 deletions
@@ -6,6 +6,11 @@ use Illuminate\Support\Facades\Log;
return new class extends Migration
{
/**
* Save each server on its own. In Postgres one failed update aborts a shared transaction and stops the upgrade.
*/
public $withinTransaction = false;
/**
* Remove the Traefik dashboard router labels from saved proxy configurations.
* Only the database is changed. The proxy shows a restart notice and applies the fix on the next restart.
@@ -141,6 +141,13 @@ test('the migration fixes saved legacy configurations without connecting to serv
->and($caddy->fresh()->proxy->last_saved_proxy_configuration)->toBe('services: {}');
});
test('the migration saves each server outside one shared transaction', function () {
// In Postgres one failed update aborts a shared transaction, so later servers could not be saved.
$migration = require database_path('migrations/2026_09_25_210000_remove_legacy_traefik_dashboard_labels.php');
expect($migration->withinTransaction)->toBeFalse();
});
test('the pending proxy notice asks the user to restart the proxy', function () {
$team = Team::factory()->create();
$user = User::factory()->create();