<?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('report_exports', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('store_id')->index();
            $table->string('name');
            $table->string('type', 50)->comment('report type key');
            $table->json('params')->nullable();
            $table->string('file_path')->nullable();
            $table->tinyInteger('status')->default(0)->comment('0=生成中 1=已完成 2=失败');
            $table->unsignedBigInteger('operator_id')->nullable();
            $table->timestamp('created_at')->nullable();
        });
    }

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