<?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('task_submissions', function (Blueprint $table) {
            $table->timestamp('start_at')->nullable()->after('task_label');
            $table->timestamp('end_at')->nullable()->after('start_at');
            $table->index(['start_at']);
            $table->index(['end_at']);
        });
    }

    public function down(): void
    {
        Schema::table('task_submissions', function (Blueprint $table) {
            $table->dropIndex(['start_at']);
            $table->dropIndex(['end_at']);
            $table->dropColumn(['start_at', 'end_at']);
        });
    }
};
