<?php

use App\Models\OrderManagement\Order;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration {

    public function up(){
        Schema::whenTableDoesntHaveColumn((new Order)->getTable(),"saved_by_cron",function (Blueprint $table){
            $table->boolean("saved_by_cron")->default(false)
                ->comment("Determine si la commande a été enregistré par le cron job");
        });

        Schema::whenTableDoesntHaveColumn((new Order)->getTable(),"status_code",function (Blueprint $table){
            $table->string("status_code",100)->nullable()
                ->comment("[FK] Le status");
        });
    }

    public function down(){

    }
};
