<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;

return new class extends Migration
{
    public function up(): void
    {
        $driver = DB::connection()->getDriverName();
        if (!in_array($driver, ['mysql', 'mariadb'], true)) {
            return;
        }

        // Change cv_path to TEXT to support JSON array of multiple document paths
        DB::statement('ALTER TABLE applications MODIFY COLUMN cv_path TEXT NULL');
    }

    public function down(): void
    {
        $driver = DB::connection()->getDriverName();
        if (!in_array($driver, ['mysql', 'mariadb'], true)) {
            return;
        }

        DB::statement('ALTER TABLE applications MODIFY COLUMN cv_path VARCHAR(255) NULL');
    }
};
