Ctrl K
ComunidadGuías…

database/migrations/2025_01_22_101105_remove_wrongly_created_envs.php

Rama main · réplica de lectura del repositorio original.

Archivo original ↗Preguntar a KiBot
<?php

use App\Models\EnvironmentVariable;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\Log;

return new class extends Migration
{
    public function up(): void
    {
        try {
            EnvironmentVariable::whereNull('resourceable_id')->each(function (EnvironmentVariable $environmentVariable) {
                $environmentVariable->delete();
            });
        } catch (\Exception $e) {
            Log::error('Failed to delete wrongly created environment variables: '.$e->getMessage());
        }
    }
};