<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        $methods = DB::table('order_shipping_methods')->get();

        foreach ($methods as $method) {
            DB::table('orders')
                ->where('shipping_method', $method->slug)
                ->update(['shipping_method_id' => $method->id]);
        }
    }
};
