<?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('partners', function (Blueprint $table) {
            if (!Schema::hasColumn('partners', 'slug')) {
                $table->string('slug', 180)->nullable()->unique()->after('name');
            }
            if (!Schema::hasColumn('partners', 'description')) {
                $table->text('description')->nullable()->after('segment');
            }
            if (!Schema::hasColumn('partners', 'seo_title')) {
                $table->string('seo_title', 255)->nullable()->after('is_active');
            }
            if (!Schema::hasColumn('partners', 'seo_description')) {
                $table->text('seo_description')->nullable()->after('seo_title');
            }
        });
    }

    public function down(): void
    {
        Schema::table('partners', function (Blueprint $table) {
            $table->dropColumn(['slug', 'description', 'seo_title', 'seo_description']);
        });
    }
};
