<?php

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

return new class extends Migration
{
    public function up(): void
    {
        Schema::table('reviews', function (Blueprint $table) {
            // Make user_id nullable for guest reviews
            $table->foreignId('user_id')->nullable()->change();
            
            // Add guest email for notifications
            $table->string('reviewer_email')->nullable()->after('reviewer_name');
        });
    }

    public function down(): void
    {
        Schema::table('reviews', function (Blueprint $table) {
            $table->dropColumn('reviewer_email');
        });
    }
};
