<?php

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

return new class extends Migration
{
    public function up(): void
    {
        Schema::table('gift_items', function (Blueprint $table) {
            $table->decimal('internal_cost', 12, 2)->default(0)->after('type');
        });

        DB::table('gift_items')->update([
            'internal_cost' => DB::raw('base_price'),
        ]);
    }

    public function down(): void
    {
        Schema::table('gift_items', function (Blueprint $table) {
            $table->dropColumn('internal_cost');
        });
    }
};

