<?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('tenants', function (Blueprint $table): void {
            $table->foreignId('header_bg_image_id')
                ->nullable()
                ->after('footer_logo_id')
                ->constrained('attachments')
                ->nullOnDelete();
            $table->foreignId('footer_bg_image_id')
                ->nullable()
                ->after('header_bg_image_id')
                ->constrained('attachments')
                ->nullOnDelete();
        });
    }

    public function down(): void
    {
        Schema::table('tenants', function (Blueprint $table): void {
            $table->dropConstrainedForeignId('footer_bg_image_id');
            $table->dropConstrainedForeignId('header_bg_image_id');
        });
    }
};
