<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::table('keyword_embeddings', function (Blueprint $table) {
            // Drop the index first, then the column
            $table->dropIndex(['tag']);
            $table->dropColumn('tag');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('keyword_embeddings', function (Blueprint $table) {
            // Add the column back
            $table->string('tag')->nullable();
            // Add the index back
            $table->index(['tag']);
        });
    }
};
