<?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('deal_slot_items', function (Blueprint $table) {
            $table->foreignId('variant_id')->nullable()->after('item_id')->constrained('item_variants')->cascadeOnDelete();
        });
    }

    public function down(): void
    {
        Schema::table('deal_slot_items', function (Blueprint $table) {
            $table->dropForeign(['variant_id']);
            $table->dropColumn('variant_id');
        });
    }
};
