<?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::table('orders', function (Blueprint $table) {
            $table->foreignId('coupon_id')->nullable()->constrained()->nullOnDelete()->after('status');
            $table->decimal('discount', 10, 2)->default(0)->after('coupon_id');
            $table->string('coupon_code')->nullable()->after('discount');
            $table->string('shipping_cost')->default('0')->after('coupon_code');
        });
    }
    public function down(): void {
        Schema::table('orders', function (Blueprint $table) {
            $table->dropColumn(['coupon_id','discount','coupon_code','shipping_cost']);
        });
    }
};
