<?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('photos', function (Blueprint $table) {
            $table->string('created_by_device_id', 120)->nullable()->after('guest_name');
            $table->index(['event_id', 'created_by_device_id', 'status'], 'photos_event_device_status_index');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('photos', function (Blueprint $table) {
            $table->dropIndex('photos_event_device_status_index');
            $table->dropColumn('created_by_device_id');
        });
    }
};
