<?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('event_meta', function (Blueprint $table) {
            $table->date('start_on')->nullable()->after('end_at');
            $table->date('end_on')->nullable()->after('start_on');
            $table->string('tzid')->nullable()->after('end_on');

            $table->index(['all_day', 'start_on']);
            $table->index(['all_day', 'end_on']);
        });
    }

    public function down(): void
    {
        Schema::table('event_meta', function (Blueprint $table) {
            $table->dropIndex(['all_day', 'start_on']);
            $table->dropIndex(['all_day', 'end_on']);

            $table->dropColumn(['start_on', 'end_on', 'tzid']);
        });
    }
};
