<?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('delivery_calendar_overrides', function (Blueprint $table) {
            $table->dropColumn('region');
            $table->foreignId('delivery_schedule_id')->nullable()->constrained()->nullOnDelete()->after('override_scope');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('delivery_calendar_overrides', function (Blueprint $table) {
            $table->dropForeign(['delivery_schedule_id']);
            $table->dropColumn('delivery_schedule_id');
            $table->string('region')->nullable()->after('override_scope');
        });
    }
};
