<?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_info_items' table to remove all rows
        DB::table('useful_info_items')->truncate();

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

            $table->dropColumn('description');
            $table->json('description');
        });
    }

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

            $table->dropColumn('description');
            $table->string('description');
        });
    }
};
