<?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::create('accurate_export_items', function (Blueprint $table) {
            $table->id();
            $table->foreignId('batch_id')->constrained('accurate_export_batches')->cascadeOnDelete();
            $table->string('exportable_type', 50);
            $table->unsignedBigInteger('exportable_id');
            $table->string('reference_no', 100)->nullable();
            $table->timestamps();

            $table->index(['exportable_type', 'exportable_id']);
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('accurate_export_items');
    }
};
