diff --git a/app/database/migrations/2026_05_22_000002_webhook_log_supplier_columns.php b/app/database/migrations/2026_05_22_000002_webhook_log_supplier_columns.php index bd50e7c6..0ac8f57c 100644 --- a/app/database/migrations/2026_05_22_000002_webhook_log_supplier_columns.php +++ b/app/database/migrations/2026_05_22_000002_webhook_log_supplier_columns.php @@ -9,8 +9,11 @@ return new class extends Migration { public function up(): void { - // Guard: only run if webhook_log exists (should always exist, but be safe) - if (! Schema::hasTable('webhook_log')) { + $conn = DB::connection('pgsql_supplier'); + + // Guard: only run if webhook_log exists (на проде после legacy-webhook-removal + // таблицы нет — миграция становится no-op). + if (! $conn->getSchemaBuilder()->hasTable('webhook_log')) { return; } @@ -18,16 +21,18 @@ return new class extends Migration base_path('/../db/migrations/2026_05_22_002_webhook_log_supplier_columns.sql') ); - DB::unprepared($sql); + $conn->unprepared($sql); } public function down(): void { - if (! Schema::hasTable('webhook_log')) { + $conn = DB::connection('pgsql_supplier'); + + if (! $conn->getSchemaBuilder()->hasTable('webhook_log')) { return; } - DB::unprepared(<<<'SQL' + $conn->unprepared(<<<'SQL' ALTER TABLE webhook_log DROP COLUMN IF EXISTS source, DROP COLUMN IF EXISTS status,