<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::table('sewas', function (Blueprint $table) {
            $table->foreignId('kota_id')->nullable()->after('paket_id')->constrained('paket_ongkir_kota')->onDelete('set null');
            $table->decimal('ongkir', 10, 2)->default(0)->after('kota_id');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('sewas', function (Blueprint $table) {
            $table->dropForeign(['kota_id']);
            $table->dropColumn(['kota_id', 'ongkir']);
        });
    }
}; 