<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        // Truncate the 'useful_infos' table to remove all rows
        DB::table('useful_infos')->truncate();

        Schema::table('useful_infos', function (Blueprint $table) {
            $table->dropColumn('name');
            $table->json('name');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('useful_infos', function (Blueprint $table) {
            $table->dropColumn('name');
            $table->string('name');
        });
    }
};
